jqGrid: making primary key columns editable while add a new record, not while updating

StackOverflow https://stackoverflow.com/questions/5377861

  •  28-10-2019
  •  | 
  •  

سؤال

In jqGrid for update/edit to work I have to make primary key columns editable.

But they should be editable only while adding a new record and not while updating an old record.

Is there a way to get around this issue? I guess this must be very common issue, but I did not find any solution to it.

Thanks in advance for helping me out.

هل كانت مفيدة؟

المحلول

I hope that another my answer (having links to two another old answers) will solve your problem.

If you use server base datatype ('json' and 'xml') the server will generate ids always and you don't ever have to make id column editable.

نصائح أخرى

If you are following the principle Inline editing you can indicate which columns you want to edit when entering on method onCellSelect or onSelectRow.

To do this you just need to change the property editable to the desired value:

$(this).getColProp('ColumnName').editable = false || true;
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top