Categories | Question details Back To List | ||
dhtmlxgrid, drag&drop, mySQL data base fails to update I have a multicolumn grid that loads from a mySQL database. When I change cell data the update to the mySQL data base occurs. When I do a drag and drop move of row database elements, although it looks fine locally, no update takes place on the mySQL database, and reloading of the page results in original data order. Is there a way to fix this? Thanks Answer posted by Stanislav (support) on Nov 12, 2009 02:42 DataProcessor and connectors are saving only data change, not the order of items, you need to customize the saving logic if you want to save the order of rows. Answer posted by mahesh on Nov 12, 2009 07:34 Stan, Any thoughts as to how to do this, or is there a way on display using grid to always do it by alphanumeric sorting? Answer posted by Stanislav (support) on Nov 12, 2009 08:58 >>or is there a way on display using grid to always do it by alphanumeric sorting If you are using connector, you can replace $grid->render_table("some",... with $grid->render_sql("SELECT * FROM some ORDER BY some_field", ... >> Any thoughts as to how to do this It possible to extend both client and server side code to send row indexes , but it can be pretty complicated ( changing single row position may require to update indexes for many rows ) Answer posted by mahesh on Nov 12, 2009 13:08 Right now I use: $grid->render_table("pphone_rad","item_id","rad_name,rad_pager,rad_office"); What I could do is render in ascending aphabetic order based on "item_id" although I am not sure how to do this. Answer posted by Alex (support) on Nov 13, 2009 02:26 Probably the following method will be correct: $grid->render_sql("SELECT * FROM pphone_rad ORDER BY item_id", "item_id","rad_name,rad_pager,rad_office"); Please, see deatils here: http://www.dhtmlx.com/dhxdocs/doku.php?id=dhtmlxconnector:loading_editing_data Answer posted by mahesh on Nov 13, 2009 08:24 Alex, Thanks, except if the data is in ascending alphabetical order it seems to do the reverse. Is there a way to make it sort in ascending alphabetical only? Answer posted by Alex (support) on Nov 16, 2009 04:47 Try to correct the SQL query: $grid->render_sql("SELECT * FROM pphone_rad ORDER BY item_id ASC", "item_id","rad_name,rad_pager,rad_office"); Answer posted by mahesh on Nov 17, 2009 09:15 Thanks Alex. |