Update is not working in dhtmlxgrid please read

Hi ,

I am trying to update the cell . when i press F2 and tring to update then it will change for that time only when i refresh the page then its show the same value not updated value can you please tell me how we update the data with steps in php :

below is my code please solve my this problem

function sortGridOnServer(ind,gridObj,direct){
mygrid.clearAll();
mygrid.loadXML(gridQString+(gridQString.indexOf(“?”)>=0?“&”:“?”)+“orderby=”+ind+“&direct=”+direct);
mygrid.setSortImgState(true,ind,direct);
return false;
}
var mygrid = new dhtmlXGridObject(‘products_grid’);
mygrid.setImagePath(“codebase/imgs/”);
mygrid.setHeader(“Catgeory,Subcategory,Subsubcategory,Tutorial Name,File Name,Action”);
mygrid.attachHeader(“#select_filter,#select_filter,#select_filter,#select_filter,#select_filter,”)
mygrid.setInitWidths(“*,150,150,150,150,150”);
mygrid.setColAlign(“left,left,left,left,left,right”);
mygrid.setColSorting(“str,str,str,str,str,str”);
mygrid.setColTypes(“ed,ed,ed,ed,ed,ed”);

mygrid.setSkin(“modern”);
mygrid.init();
mygrid.enableSmartRendering(true);
gridQString = “<?php echo base_url();?>category_module/show_data”;//save query string to global variable (see step 5 for details)
mygrid.loadXML(gridQString );
mygrid.attachEvent(“onBeforeSorting”,sortGridOnServer);
mygrid.attachEvent(“onRowSelect”,doOnRowSelected);

function doOnRowSelected(rowID,celInd)
{
alert("Selected row ID is “+rowID+”\nUser clicked cell with index "+celInd);

}

a) the above code contains only initialization of grid, to enable data saving it must have also dataprocessor initialization
dhtmlx.com/docs/products/dht … _init.html

b) if you are using custom logic for data logic - be sure that you data feed script is not cached by browser ( you may try to add some unique element in it )

HI Stanislav,

thanks for reply , if possible can you please tell me where i am wrong . i am sending you my full code .when i fetch data from one table it works fine but when i fetch data with multiple query update not working.

please check my below code

<script src="<?php echo base_url();;?>public/js/codebase/dhtmlxgrid_excell_link.js" type="text/javascript" ></script>

php file

require_once(“config.php”);
require(“grid_connector.php”);

$res=mysql_connect($mysql_server,$mysql_user,$mysql_pass);
mysql_select_db($mysql_db);
function color_rows($row)
{
if ($row->get_index()%2) {
$row->set_row_style(“background-color: light gray”);
}
}
$grid = new GridConnector($res);
$grid->dynamic_loading(100);
$grid->enable_log(“log.txt”);
$grid->event->attach(“beforeRender”,“color_rows”);
$grid->event->attach(“beforeUpdate”,“myUpdate”);

function myUpdate($action){
mysql_query(“UPDATE category_table SET category_name=’{$action->get_data(‘category_name’)}’ WHERE category_id=’{$action->get_id()}’”);
$action->success();
}
$sql=“SELECT t.tutorial_id as id,ssc.sub_sub_category_id as id,sc.sub_category_id as id, c.category_id as id, t.tutorial_name,t.file_name,t. tutorial_content,ssc.sub_sub_category_name,ssc.sub_sub_category_content,sc.sub_category_name,sc.sub_category_content,c.category_name,c.category_desc FROM tutorial_table t LEFT JOIN
sub_sub_category_table ssc ON t.sub_sub_category_id = ssc.sub_sub_category_id LEFT JOIN
sub_category_table sc ON ssc.sub_category_id = sc.sub_category_id LEFT JOIN
category_table c ON ssc.category_id = c.category_id”;

 $grid->render_sql($sql,"id","id,category_name,sub_category_name,sub_sub_category_name,tutorial_name,file_name");

but when i update this is not work . can you please tell what i do for update .

also one thing i have join 4 tables and show data how i update the data if this is not working . please give me solution.

Thanks in advance

a) please try to change order of files as

connector after dataprocessor

Server side code looks correct, code in render_sql will not be able to produce automatic CRUD updates, but you are using custom myUpdate handler, so data must be correctly saved ( insert and delete operations will fail )