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 :wink:

a) You can check
dhtmlx.com/docs/products/dhtmlxG … aprocessor

>>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

wooooooooow… the php connector is wonderful… :wink: thank you very much… it’s working

Hi again,

I have other questions now, using PHP connector

  1. how can I create subgrid?
  2. how can I group 2 fields from database to appear in the same collumn?
  3. how can I apply a php function to a database field? (ex. in database I have a field time_field with a timestamp value - 1238670470, and I want to use a function date(‘d-m-Y h:m:s’, time_field), in order to have in my grid something like 03-04-2009 12:29:30

Is there any posibility to create manually the output XML, using in the same time the PHP connector - $grid->render_sql?

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 - dhtmlx.com/docs/products/dhtmlxC … l#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 sending.