php - How to create a CRUD using Kendo UI grid popup editing and Codeigniter (Controller,Model,View)? -


hello guys can give me example of how can access methods/functions in codeigniter kendoui datagrid?

i used example of kendo ui don't know how integrate ci:

   <script>             $(document).ready(function () {                 var crudservicebaseurl = "http://demos.kendoui.com/service",                     datasource = new kendo.data.datasource({                         transport: {                             read:  {                                 url: crudservicebaseurl + "/products", /* view list? can use <?php echo site_url('user_controller/index'); ?> ? */                                 datatype: "jsonp"                             },                             update: {                                 url: crudservicebaseurl + "/products/update", /* how can hidden id> */                                  datatype: "jsonp"                             },                             destroy: {                                 url: crudservicebaseurl + "/products/destroy",                                 datatype: "jsonp"                             },                             create: {                                 url: crudservicebaseurl + "/products/create",                                 datatype: "jsonp"                             },                             parametermap: function(options, operation) {                                 if (operation !== "read" && options.models) {                                     return {models: kendo.stringify(options.models)};                                 }                             }                         },                         batch: true,                         pagesize: 20,                         schema: {                             model: {                                 id: "productid",                                 fields: {                                     productid: { editable: false, nullable: true },                                     productname: { validation: { required: true } },                                     unitprice: { type: "number", validation: { required: true, min: 1} },                                     discontinued: { type: "boolean" },                                     unitsinstock: { type: "number", validation: { min: 0, required: true } }                                 }                             }                         }                     });                  $("#grid").kendogrid({                     datasource: datasource,                     pageable: true,                     height: 430,                     toolbar: ["create"],                     columns: [                         { field:"productname", title: "product name" },                         { field: "unitprice", title:"unit price", format: "{0:c}", width: "100px" },                         { field: "unitsinstock", title:"units in stock", width: "100px" },                         { field: "discontinued", width: "100px" },                         { command: ["edit", "destroy"], title: "&nbsp;", width: "160px" }],                     editable: "popup"                 });             });         </script>     </div> 

view process

for example if have controller this(user_controller)

public function index(){     $data['users'] = $this->user_model->user_detail();     $this->load->view('supplier/index',$data); } 

and model this(user_model)

public function user_detail(){     $getuser = "select * users";     $resultuser = $this->db->query($getuser);     return $resultuser; } 

how can display put in datasource?

add process

if have function this

public function addnewuser(){    $this->load->view('user/addnewuser'); } 

if have view this

/* how create form in kendoui? echo form_open('user_controller/addnewuser');    echo "<input type='text' name='name' value='' required='required' />";    echo "<input type='submit' value='add'/>"; echo form_close(); 

and model this

public function addnewuser(){    $add = array(       'id' => null,       'name' => $this->input->post('name')    );    $this->db->insert('users',$add); } 

update process

and if have function update this:

public function user_update(){     $this->user_model->userupdateinfo();     redirect('user_controller/index'); } 

and in model this

public function userupdateinfo(){     $id = $this->input->post('id');     $name = $this->inpput->post('name');     $updatenow = array(       'name' => $name    );    $this->db->where('id',$id);    $this->db->update('users',$updatenow); } 

in delete same question in update

that's guys hope can me. have little understanding in jquery want learn it. if know sites same can give me example of comment me. or can give me working example of it? email me @ rochellecanale11@gmail.com or chelle@hallohallo.ph


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -