title: kendo ui grid crud with codeigniter
body: <ol>
  <li><p>pleas help me with sample kendo grid with codeigniter controller</p>
  
  <h1>    my view</h1>
  
  <pre><code>$("#grid").kendoGrid({
  dataSource: {
      transport: {
          read: {
              url: 'schoolC/crud',
              contentType: 'application/json'
          },
          create: {
              url: 'schoolC/crud',
              type: "PUT",
              datatype: 'json'
          },
          update: {
              url: 'schoolC/crud',
              type: "POST",
              datatype: 'json'
          },
          destroy: {
              url: 'schoolC/crud',
              type: "POST",
              datatype: 'json'
          }                                
      },
      error: function(e) {
              alert(e.responseText);
          },
      schema: {
          data: "data",
          id: "school_id",
          model: {
              fields: {
                  school_name: { 
                      type: "string",
                      validation: { required: true }
                  }
              }
          }
      },
      pageSize: 10
  },
  height: 400,
  batch: false,
  scrollable: true,
  sortable: true,
  filterable: true,
  resizable: true,
  toolbar: ['create'],
  editable: "popup",
  pageable: {                            
      numeric: true,
      refresh: true,
      pageSizes: true
  }, 
  columns: [
      {
          field: "school_name",
          title: "School Name",                                
          width: 100
      },
      { command: ["edit", "destroy"], title: "&amp;nbsp;", width: "210px" }                            
  ]
  </code></pre>
  
  <p>});</p>
  
  <h1>Controller method</h1>
  
  <pre><code>function crud()
  {
      header("Content-type: application/json");
      switch($_SERVER["REQUEST_METHOD"])
      {
          case 'GET':
              echo $this-&gt;SchoolM-&gt;get_allJsonData(); 
          break;
          case 'PUT':
              echo $this-&gt;SchoolM-&gt;addSchoolInfo(array('school_name'=&gt; mysql_real_escape_string($_POST["school_name"])));
          break;
          case 'POST':
              echo $this-&gt;SchoolM-&gt;updateSchoolInfo(array('school_name'=&gt; mysql_real_escape_string($_POST["school_name"])), array('school_id'=&gt; mysql_real_escape_string($_POST["school_id"])));
          break;
          case 'DELETE':
              echo $this-&gt;SchoolM-&gt;deleteSchool(mysql_real_escape_string($_POST["school_id"]));               
          break;
      }
  }
  </code></pre>
  
  <h1>Model methods</h1>
  
  <pre><code>function get_allJsonData()
  {
      $arr = array();
      $this-&gt;db-&gt;from('school');
      $this-&gt;db-&gt;order_by("school_name", "asc");
      $query = $this-&gt;db-&gt;get();
      foreach($query-&gt;result_object() as $rows )
      {
          $arr[] = $rows;
      }
      return "{\"data\":" .json_encode($arr). "}";
  }
  function addSchoolInfo($school_name)
  {
      return json_encode($this-&gt;db-&gt;insert('school',$school_name));
  } 
  function updateSchoolInfo($school_date, $condition)
  {
      return json_encode($this-&gt;db-&gt;update('school', $school_date, $condition));
  }
  function deleteSchool($school_id)
  {
      $this-&gt;db-&gt;where_in('school_id',$school_id);
      return json_encode($this-&gt;db-&gt;delete('school'));
  }   
  </code></pre>
  
  <p>i am using codeigniter it read but the rest create update and delete are not properly work. It also add many empty rows as the size of the rows in each create operation.pls help me  </p></li>
  </ol>