ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: rgorantla on October 15, 2014, 06:49:31 pm

Title: Non-editable Cells - Required ? - Need this -IMportant
Post by: rgorantla on October 15, 2014, 06:49:31 pm
Hi,

Resolved all other issues i was having before - only 1 requirement -

If i change funding value to SI - admin fees columns become editable - I am trying to write a validation call back to make basic admin fee and total admin fee as required when the cell is editable ... I am not able to accomplish this ... Can you help me with an example on how to do this please?


Also, if you can tell me if there is any way to add tootltip like we add class

Ex:  $grid.pqGrid("addClass", { rowIndx: rowIndx, dataIndx: dataIndx, cls: 'yellow' });

Thanks much !
Title: Re: Non-editable Cells - Required ? - Need this -IMportant
Post by: paramvir on October 16, 2014, 07:58:24 pm
Code: [Select]
if (grid.isEditableCell({ rowIndx: rowIndx, dataIndx: ui.column.dataIndx }) == true) {
   if(ui.value == null || ui.value == "" ){
        return false;
   }
   else{
        return true;
   }
}
else{
  return true;
}
Title: Re: Non-editable Cells - Required ? - Need this -IMportant
Post by: rgorantla on October 16, 2014, 11:37:14 pm
Hi,

i wrote the same thing - but the issues is - when you click save though this cell is non-editable - focus will be on this cell until you enter soemthing

validations:[ { type:function(ui)
             {
                 var grid = $(this).pqGrid('getInstance').grid;
                 if (grid.isEditableCell({ rowIndx: rowIndx, dataIndx: ui.column.dataIndx }) == true)
                 {
                     if (ui.value == null || ui.value == "")
                     {
                         ui.icon == 'ui-icon-info';
                         ui.msg = "Required";
                         return false;
                     }
                     else
                     {
                         return true;
                     }
                 }
                 else
                 {
                     return true;
                 }
             }
             }],
Title: Re: Non-editable Cells - Required ? - Need this -IMportant
Post by: paramvir on October 17, 2014, 12:25:32 am
you are right. This is an undesirable issue which would be fixed in next release.

And I found the reason for this happening is when field value is null grid considers it invalid data.

the workaround is to put "" in that field. "" can be put into that field by addRow and updateRow ( along with checkEditable: false )

updateRow({rowIndx: rowIndx, row: { adminfees: ""}, checkEditable: false })
Title: Re: Non-editable Cells - Required ? - Need this -IMportant
Post by: paramvir on October 22, 2014, 11:08:14 pm
As a side note, you might need to reduce the repetition of code.

I see you have created separate validation and editor function for every column even when the logic is same in every function. You could write a common named function and use it for different columns.