EasyUI Forum
May 20, 2024, 11:30:25 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Poll
Question: why am I getting this error when I try editing a cell and move of iit?
edatagrid - 0 (0%)
isError - 0 (0%)
Total Voters: 0

Pages: [1]
  Print  
Author Topic: edatagrid - cannot read property 'isError' of null [SOLVED]  (Read 6589 times)
svsnead
Newbie
*
Posts: 15


View Profile Email
« 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>



« Last Edit: February 10, 2016, 05:46:55 PM by svsnead » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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({
onError: function(index,row){
//...
}
});
Logged
svsnead
Newbie
*
Posts: 15


View Profile Email
« Reply #2 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.'));
}
« Last Edit: February 10, 2016, 07:35:34 AM by svsnead » Logged
svsnead
Newbie
*
Posts: 15


View Profile Email
« Reply #3 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);
   }
});

« Last Edit: February 10, 2016, 08:08:50 AM by svsnead » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!