Categories | Question details Back To List | ||
Grid + complex Update Hi, my question is why not update code PHP + grid <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link rel="STYLESHEET" type="text/css" href="../scripts/dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgrid.css"> <script src="../scripts/dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxcommon.js"></script> <script src="../scripts/dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgrid.js"></script> <script src="../scripts/dhtmlxGrid/dhtmlxGrid/codebase/dhtmlxgridcell.js"></script> <script src="../scripts/dhtmlxGrid/dhtmlxGrid/codebase/ext/dhtmlxgrid_srnd.js"></script> <script src="../scripts/dhtmlxGrid/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor.js"></script> <script src="../scripts/dhtmlxGrid/dhtmlxGrid/codebase/ext/dhtmlxgrid_filter.js"></script> <script src="../scripts/grid/connector.js" type="text/javascript" charset="ISO-8859-1"></script> <script src="../scripts/dhtmlxGrid/dhtmlxDataProcessor/codebase/dhtmlxdataprocessor_debug.js"></script> </head> <body> <div id="gridbox" style="width:500px; height:320px;"></div> <script> mygrid = new dhtmlXGridObject('gridbox'); mygrid.setImagePath("../scripts/dhtmlxGrid/dhtmlxGrid/codebase/imgs/"); mygrid.setHeader("Usuario,Modulos,Privilegios,#cspan,#cspan,#cspan"); mygrid.attachHeader("#rspan,#rspan, Alta, Baja, Edita, Imprime") mygrid.attachHeader("#connector_select_filter,#connector_select_filter, , , , ") mygrid.setInitWidths("100,*,50,50,50,60") mygrid.setColTypes("ro,ro,ch,ch,ch,ch"); mygrid.setColAlign("left,left,center,center,center,center"); mygrid.setColSorting("connector,connector") mygrid.enableSmartRendering(true) mygrid.enableMultiselect(true); mygrid.init(); mygrid.setSkin("modern") mygrid.setColumnIds("usuario,modulo,alta,baja,editar,imprimir"); mygrid.loadXML("data_connector.php"); dp = new dataProcessor("data_connector.php"); dp.init(mygrid); dp.enableDataNames(true); </script> </body> </html> -----------CODE CONNECTOR ------------- require_once("../data/conectarse.php"); $link = conectarse2(); require("../scripts/grid/grid_connector.php"); $grid = new GridConnector($link); $grid->enable_log("temp.log",true); function my_update($action){ $alt=$action->get_value("c2"); $baj=$action->get_value("baja"); $edi=$action->get_value("editar"); $imp=$action->get_value("imprimir"); mysql_query("UPDATE sis_permisos SET alta='{$alt}', baja='{$baja}', editar='{$edi}', imprimir='{$imp}' WHERE id='{$action->get_id()}"); $action->success(); //if you have made custom update - mark operation as finished } $grid->event->attach("beforeUpdate","my_update"); $grid->render_sql("select empleados.nombre,id_modulo,sis_permisos.alta,sis_permisos.baja,sis_permisos.editar,sis_permisos.imprimir from sis_permisos INNER JOIN empleados ON sis_permisos.id_usuario = empleados.clave","sis_permisos.id","nombre,id_modulo,alta,baja,editar,imprimir"); ------------------------------- update only alta,baja,editar,imprimir ---------------- thanks Answer posted by Stanislav (support) on Oct 05, 2009 02:59 Please beware that usage of dp.enableDataNames(true); will prevent any auto operation ( insert, update, delete) You are using mygrid.setColumnIds("usuario,modulo,alta,baja,editar,imprimir"); and $alt=$action->get_value("c2"); There is no column with id == c2, most probably it must be a $alt=$action->get_value("alta"); If issue still occurs - please provide the content of log file for problematic operation. |