Categories | Question details Back To List | ||
How to send cell values from grid to PHP file Hi, I use a grid with a PHP file for update: myDataProcessor = new dataProcessor("update.php"); myDataProcessor.setTransactionMode("POST"); myDataProcessor.enableDataNames(true); myDataProcessor.setUpdateMode("cell"); myDataProcessor.enableDebug(true); myDataProcessor.init(mygrid); In my grid, I have a editable cell 'Name', and, when I edit this cell from a row, I want to send this new value to update.php and then to update this information in my database. How can I do this? What's the name of this cell in my PHP file, how can I call them, with what name? Thanks a lot! PS: dhtmlx is great ;) Answer posted by Support on Apr 02, 2009 08:52 a) You can check http://dhtmlx.com/docs/products/dhtmlxConnector/index.shtml This is set of PHP classes , which automates server side tasks. b) If you want to have a custom server side code , be sure to add the next line to the grid's init grid.setColumnIds("some,some,name,some") In such case for each update action, your server side script will receive a value of related column $_GET["column_id"] , where column_id - value defined by setColumnIds command To get more info you can check next document http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Dataprocesor_usage.html#grid_art_dataprocessor >>myDataProcessor.enableDebug(true); If you are using 2.1 version, instead of this command just include dhtmlxdataprocessor_debug.js file in addition to existing files, it will show detailed log of all client side actions Answer posted by pepys on Apr 03, 2009 01:27 wooooooooow..... the php connector is wonderful.. ;) thank you very much.. it's working Answer posted by pepys on Apr 03, 2009 02:29 Hi again, I have other questions now, using PHP connector
Answer posted by pepys on Apr 03, 2009 02:30 Is there any posibility to create manually the output XML, using in the same time the PHP connector - $grid->render_sql? Answer posted by Support on Apr 03, 2009 03:03 Connector classes provides two way of extending a) you can create a new class by extending existing GridConnector Package contains dhtmlxconnector_api_detailed_reference.zip which contain info about existing class hierarchy Redefining the render_set method of connector will give you full control over XML generation. b) you can use server side events to control the XML output function my_code($data){ // $data - GridDataItem structure - http://dhtmlx.com/docs/products/dhtmlxConnector/doc/api.html#cc_api_a ...any processing here... } $grid->event->attach("beforeRender",my_code) >>how can I group 2 fields from database to appear in the same collumn? function my_code($data){ //a and b - names of columns $a=$data->get_value("a")." ".$data->get_value("b"); $data->set_value("a",$a); } >>how can I apply a php function to a database field? function my_code($data){ //a and b - names of columns $a=date('d-m-Y h:m:s',$data->get_value("a")); $data->set_value("a",$a); } >>how can I create subgrid? On client side - define some column as subgrid, on server side function my_code($data){ $a=$data->get_value("a"); $data->set_value("a","some_other.php?for=".$a); } Where some_other.php , connector for sub-grid, where use can use render_sql and $_GET["for"] to provide necessary set of data. The tricky point - connector will provide only data not the header structure , so you need to define grid structure on client side through onSubGridCreated event or extend connector class to allow custom <head> sending. |