Problem with update grid with render_sql/render_table

I load a grid, which is a sub set of a table filtered by an id, with:

if ($gridConn->is_select_mode()) {
 	$strSQL = "SELECT item, descrizione, um, qta, cu, stima_tot FROM offerte_attivita where id_offerta = ".$_GET['id'];
else {

At load it works, but when update a cell doesn’t work.
The log show:

Log started, 22/12/2010 11:12:19

DataProcessor object initialized
1293057792x0_gr_id => 1293057792x0
1293057792x0_c0 => 1
1293057792x0_c1 => asciugaturapppp
1293057792x0_c2 => h
1293057792x0_c3 => 2
1293057792x0_c4 => 3
1293057792x0_c5 => 0
1293057792x0_!nativeeditor_status => updated
ids => 1293057792x0

Row data [1293057792x0]
id_attivita => 1293057792x0
item => 1
descrizione => asciugaturapppp
um => h
qta => 2
cu => 3
stima_tot => 0
!nativeeditor_status => updated

UPDATE offerte_attivita SET item='1',descrizione='asciugatura',um='h',qta='2',cu='3',stima_tot='0' WHERE id_attivita='1293057792x0'

Edit operation finished
0 => action:updated; sid:1293057792x0; tid:1293057792x0;

Done in 0.025945901870728s

Note that id_attivita=‘1293057792x0’ that, instead, is = 1.
Any ideas?
Thanks you.

I came here to post this exact same issue. I have a grid (at table.php) in which I want to load a certain subset of my large table based on URL parameters (i.e. going to table.php?client=XXX would load a DHTMLX grid which has been filtered by my desired client at the server-level). DHTMLX’s built in filtering, while excellent, only “hides” rows and doesn’t really keep them out of the table, so I think this has to be done serverside.

Below is my code for the DB connector:[code]

$client = $_GET[‘client’];

$grid = new GridConnector($res);
 $grid->enable_log("error.log", true);

$grid->render_SQL(“select $col from sku where client=’$client’”,“pkey”,“sku_number,client,employee”)


You can see I have also set it up to only take certain columns from the master “sku” table based on settings stored in a separate “client” table.

Using Firebug, I’ve compared my POST requests for the following two examples:

$grid->render_table("sku", "pkey")


$grid->render_SQL("select $col from sku where client='$client'","pkey","sku_number,client,employee")

Using method 1 (render_table), update works as intended and my request looks as follows:

Using method 2 (render_SQL), the change reflects on the grid but it hasn’t really updated. My request look as follows:

The ID of “1” above is definitely the primary key of my table. I have no idea why the primary key is getting so mashed up when using “render_sql”. Anybody have any ideas on how to fix this?

Thanks so much for all the work you guys do!

You are not providing correct ids for original dataset, so update operation will fail, because grid will use random unique IDs instead of DB-related onex.
Just fix above code as

$strSQL = "SELECT id_attivita, item, descrizione, um, qta, cu, stima_tot FROM offerte_attivita where id_offerta = ".$_GET['id']; $gridConn->render_sql($strSQL,"id_attivita","item,descrizione,um,qta,cu,stima_tot");

$grid->render_SQL(“select $col from sku where client=’$client’”,“pkey”,

Same as above, change it as

$grid->render_SQL("select pkey,$col from sku where client='$client'","pkey",

If you have some random numbers instead of valid IDs - it is mean that render_sql command has not valid ID field specified|selected.

Oh boy, thats really one of those “smack yourself in the head” moments of stupidity! Added the pkey column from the initial data load and everything works perfectly.

I truly appreciate you taking the time to answer this question!

Thanks so much!!!
Sorry for the late in responding.

I’ve correct and now it works.
Bye, best regards

so the update fails

$grid->render_sql("select id ,name,enabled,flagNew from orders where not flagArea and substring(id,7,1)=’_’ ",“id”,“id,name,enabled,flagNew” );

so the update works

$grid->render_sql(“select id ,name,enabled,flagNew from orders where not flagArea”,“id”,“id,name,enabled,flagNew” );

DB MySql 5.1.41


why ?

You can have above code in connector file as

if ($grid->is_select_mode())
$grid->render_sql("select id ,name,enabled,flagNew from orders where not flagArea and substring(id,7,1)=’_’ ",“id”,“id,name,enabled,flagNew” );

HI stanislav

I tried, but it does not work.

I changed substring(id,7,1) with length(id)>9 but fails

Another problem is the character ‘_’, putting in the filter (mysql need escape ‘\ _’) filter works update fails .
the simple code is


If you filter on a different character (eg ‘A’) works…

Yep, there may be a problem with IDs, which has “_” character inside, because this character used as separator during saving operations.

Unfortunately it can’t be fixed easily

I checked …
you are right the problem is just that … the character ‘_’ in 'IDs.

I checked
you are right the problem is just that … the character ‘_’ in 'IDs.