EasyUI Forum
May 05, 2024, 01:20:52 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Table doesn't display data  (Read 4536 times)
davids
Newbie
*
Posts: 3


View Profile
« on: February 25, 2016, 06:04:17 AM »

Hallo everybody!

I have a very simple table:
http://178.62.11.185/rallijs/cekpointi/

The error I get in browser console is "Uncaught TypeError: Cannot read property 'length' of null".

My table and form is as followed (almost the same as downloaded example)

 <table id="dg" title="Čekpointi" class="easyui-datagrid" style="width:700px;height:auto"
      url="<?php echo esc_url( get_template_directory_uri() ) ; ?>/cek/get_users.php"
      toolbar="#toolbar" pagination="true"
      rownumbers="true" fitColumns="true" singleSelect="true">
    <thead>
      <tr>
       <th field="id" width="50">id</th>
        <th field="nosaukums" width="80">Nosaukums</th>
        <th field="kategorija" width="50">Kategorija</th>
        <th field="vajadzigs" width="50">Vajadzīgs</th>
      </tr>
    </thead>
  </table>
  <div id="toolbar">
   <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">Jauns</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Labot</a>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Dzēst</a>
  </div>
 
  <div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"
      closed="true" buttons="#dlg-buttons">
    <div class="ftitle">čekpoints</div>
    <form id="fm" method="post" novalidate>
      <div class="fitem">
        <label>Nosaukums</label>
        <input name="nosaukums" class="easyui-textbox" required="true">
      </div>
      <div class="fitem">
        <label>Kategorija</label>
        <input name="kategorija" class="easyui-textbox" required="true">
      </div>
      <div class="fitem">
        <label>Vajadzigs</label>
        <input name="vajadzigs" class="easyui-textbox" required="true">
      </div>
    </form>

Here is my get_users function.

<?php
   $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
   $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
   $offset = ($page-1)*$rows;
   $result = array();

   include 'conn.php';
    mysql_set_charset($con, "utf8");
   $rs = mysql_query("select count(*) from wp_checkpoint");
   $row = mysql_fetch_row($rs);
   $result["total"] = $row[0];
   $rs = mysql_query("select id, nosaukums, kategorija, vajadzigs from wp_checkpoint limit $offset,$rows");
   
   $items = array();
   while($row = mysql_fetch_object($rs)){
      array_push($items, $row);
   }
   $result["rows"] = $items;

   echo json_encode($result);


?>


Could you give me some advice what is wrong here?

Thank you in advance!

Logged
davids
Newbie
*
Posts: 3


View Profile
« Reply #1 on: February 25, 2016, 08:33:18 AM »

I figured out that problem is with the string value with name 'nosaukums'. Other columns are int-type. Should I display or encode the strings in some special way?
Logged
davids
Newbie
*
Posts: 3


View Profile
« Reply #2 on: February 25, 2016, 09:59:21 AM »

I "solved" it by myself. I deleted some rows in database and recreated them exactly with the same content. And now it works! No idea what was wrong there.
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!