views:

590

answers:

2

Hi

In my grids on the page, all of them need to not only have inline edit disabled, but ALSO should be editable via the modal form ONLY.

However, turning editable : false, while preventing in-line edits, also prevents editing via the form (no columns can be seen on the form, just the Submit and Cancel buttons)

How can I effect this behavior? Or is it not possible with the current version (3.5.2)

I also tried to enable editable (:true) (after having turned it off in the colModel declaration) within the beforeFormShow and onInitializeForm event handlers, but there are no columns displayed in either the edit or add forms.

Thanks very much for any insight you provide...

Here's what I'm doing -

           var addprm = { 
                     width: 450, 
                     height: 200,
                     top: 125, 
                     left: 50, 
                     beforeShowForm: function(formId) {
                         id= jQuery('#list10').getGridParam('selrow');
                         alert('From AddPrm: formId=' + formId + " id=" + id);
                         var ret = jQuery('#table').getRowData(id);
                         jQuery('#list10').setColProp('tr_a_name',{editable:true});
                         jQuery('#list10').setColProp('tr_a_desc',{editable:true});
                         jQuery('#list10').setColProp('tr_a_comments',{editable:true});
                     },  
                     reloadAfterSubmit:true, 
                     closeAfterAdd:true
             };

And like wise for the editprm object, with the tr_ prefix and without (as in colModel)

A: 

You do not want inline editing, but you do want form editing, correct? Don't know whether it's this simple, but what works for me is to set each column as editable:true, but then keep cellEdit:false, which I think is the default. My guess is that you have cellEdit set to true. Sorry if I'm way off here.

Ed
+1  A: 

I belive you can override the onSelectRow method so that it does not trigger a row_edit response and forces a model response. like so:

jQuery("#grid_id").jqGrid({
  ....init stuff.....
  onSelectRow: function(id){
     jQuery("#grid_id").editGridRow( id, properties );
  }
  .....other stuff......
 })
Didius
Good tip, thanks, this worked!
ombud