Title: edatagrid - cannot read property 'isError' of null [SOLVED] Post by: svsnead on February 09, 2016, 10:43:10 AM Hello I am newbie and would really appreciate a point in the right direction. The error is caught on line 114 of the jquery.edatagrid.js. The line reads:
if (data.isError){ $(target).edatagrid('cancelRow',index); $(target).edatagrid('selectRow',index); $(target).edatagrid('editRow',index); opts.onError.call(target, index, data); return; } this is my code: $(function(){ $('#dg').edatagrid({ url: 'get_users.php', saveUrl: 'save_user.php', updateUrl: 'update_user.php', destroyUrl: 'destroy_user.php' }); }); <table id="dg" title="Members" class="easyui-datagrid" style="width:1300px;height:450px" toolbar="#toolbar" pagination="true" idField="id" rownumbers="true" fitColumns="true" singleSelect="true"> <thead> <tr> <th field="name_last" width="50" editor="text">Last Name</th> <th field="name_first" width="60" editor="text">First Name</th> <th field="chapter_city" width="70" editor="text">Chapter</th> <th field="status" width="35" editor="text">Status</th> <th field="email" width="60" editor="text">Email</th> <th field="address" width="60" editor="text">Address</th> <th field="city" width="40" editor="text">City</th> <th field="state" width="15" editor="text">State</th> <th field="zip" width="25" editor="text">Zip</th> <th field="phone" width="45" editor="text">Phone</th> </tr> </thead> </table> Title: Re: edatagrid - cannot read property 'isError' of null Post by: stworthy on February 09, 2016, 06:41:43 PM The 'onError' event fires when the server errors occur. The server should return a row with 'isError' property set to true to indicate some errors occur.
Code: $('#dg').edatagrid({ Title: Re: edatagrid - cannot read property 'isError' of null Post by: svsnead on February 09, 2016, 07:09:49 PM Thanks so much. So what you are saying is that it is on the server end? So would that be the update_users.php then as that would be the change of edit a cell right? I'm using pretty much the demo program so I would think it would not have problems. I did have to change mysql to mysqli calls though. I also don't think it is making it to the update_users.php I believe the error is before that when the cell changes it errors out using Inspect on chrome at line 114 edatagride.js. The get_users.php is working it does get the user data. I will use the onError Event to see if that points to the problem.
This is my update_users.php $id = intval($_REQUEST['id']); $name_first = htmlspecialchars($_REQUEST['name_first']); $name_last = htmlspecialchars($_REQUEST['name_last']); $phone = htmlspecialchars($_REQUEST['phone']); $email = htmlspecialchars($_REQUEST['email']); var_dump($id); include 'db_connect.php'; $sql = "update bs_members set name_first='$name_first',name_last='$name_last',phone='$phone',email='$email' where id=$id"; $result = $mysqli->query($sq); echo json_encode(array( 'id' => $id, 'name_first' => $name_first, 'name_last' => $name_last, 'phone' => $phone, 'email' => $email )); } else { echo json_encode(array('errorMsg'=>'Some errors occured.')); } Title: Re: edatagrid - cannot read property 'isError' of null Post by: svsnead on February 10, 2016, 07:57:22 AM I installed the onError handler and I not getting anything back. The error is on line 114 of the edatagrid and I believe it before it even calls the update_user.php file. Any ideas on what I can do to resolve this problem? I using chrome Inspect and it erring at line 114 of the edatagrid.js.
//server side code echo json_encode(array( 'isError' => true, 'msg' => 'error message.' )); //client side code $('#dg').edatagrid({ onError: function(index,row){ alert(row.msg); } }); (http://www.bshdfcle.org/wp-content/themes/html5blank-bshdfc/src/test/isError.jpg) |