Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQGrid primary key issue when delete

I have primary key of my row as hidden field in my jQGrid. It is called "UserId"

colNames: ['UserId', "Details" ...],
colModel: [{ name: 'UserId', index: 'UserId', editable: false, hidden: true },
          { name: 'Details', index: 'Details', editable: true, editactioniconscolumn: true },
           ...]

I get worked create and update cases but i have an issue with delete

Because when delete i am getting an Id of the grid row back on controller and not UserId, I can keep all UserId's in grid id, that is what i am currently done to make delete work, but i am wondering is there any way to get my hidden UserId getting posted instead of grid row Id.

like image 732
Vasya Pupkin Avatar asked Jun 08 '11 06:06

Vasya Pupkin


1 Answers

You can implement your requirements in many ways:

  1. If the value from the UserId column is unique on the page and can be used to identify the row you can add key:true property to the UserId column definition in the colModel.
  2. You can use beforeSubmit or onclickSubmit event to modify the postdata parameter and add additional information which will be send to the server. See here for an example.
  3. Use delData property exactly like editData which I described here.
  4. Use serializeDelData event. See here and this.
like image 70
Oleg Avatar answered Dec 15 '22 20:12

Oleg