ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: rgorantla on September 19, 2014, 08:31:16 pm

Title: Read Only Cells
Post by: rgorantla on September 19, 2014, 08:31:16 pm
Hi,

i Have column groups(A ', B) - 1 column in Group A has a radio button - if it is yes then Group B should be grayed out (Users cannot edit or enter any data) , if it is NO then it should be editable.

Is there any group/column property to set the editable property or anything for the above mentioned requirement?

Title: Re: Dependencies
Post by: paramvir on September 22, 2014, 01:51:09 am
Every column has editable property, the callback variant can be used for the above requirement. The value of radio button can be checked in this callback as ui.rowData[ "dataIndx_of_radio_button_column" ] and return true/false accordingly.

http://paramquery.com/pro/api#option-column-editable
Title: Re: Dependencies
Post by: rgorantla on September 22, 2014, 07:54:23 pm
Thank you , is there any css class to look Gray if editable is false ?
Title: Re: Dependencies
Post by: paramvir on September 22, 2014, 10:45:50 pm
For that you have to take help of column.render callback for columns in group B.

In this callback check whether the cell is editable with isEditableCell API

http://paramquery.com/pro/api#method-isEditableCell

If non-editable then add class e.g., grayClass and if editable then remove the  class.

And then some css
Code: [Select]
div.pq-grid tr td.grayClass{
    color: gray;   
}
Title: Re: Dependencies
Post by: rgorantla on September 23, 2014, 11:25:41 pm
Hi,

I tried this(below code) in one of the columns in column B - but the class is applied only when the cell is clicked ... But i want all editable cells to be grayed out when i have fundvalue as "FI" ... Any suggestions ?

editable: function (ui) {
                 if (ui.rowData != undefined) {
                     var fundvalue = ui.rowData.funding;
                     if (fundvalue == "FI") {
                         //console.log(ui);
                         var ri = ui.rowIndx;
                        $grid.pqGrid("addClass", { rowIndx: ri, dataIndx: 'adminfeebasis', cls: 'grayClass' });
                         return false;
                     }
                     else {
                         return true;
                     }
                 }
                 else {
                     return true;
                 }
Title: Re: Dependencies
Post by: paramvir on September 23, 2014, 11:32:46 pm
Every callback has its own separate purpose.

As mentioned in the previous reply, please add / remove class in the column.render callback. ( not in column.editable )

http://paramquery.com/pro/api#option-column-render

And check this demo for how to add class in the current cell using JSON format

http://paramquery.com/pro/demos/render_cells
Title: Re: Dependencies
Post by: rgorantla on September 26, 2014, 07:15:56 pm
Hi,

I have written in render callback function - but still unless you are in the column B and click this class is not getting rendered - But i am looking for is if you change value in Column A - these cells need to be grayed out before you going into the cells

  render: function (ui) {
                 var rowix = ui.rowIndx,
                 dataIndx = ui.dataIndx;
                 if ($("#medicaltable").pqGrid("isEditableCell", { rowIndx: rowix, dataIndx: dataIndx })) {
                     $grid.pqGrid("removeClass", { rowIndx: rowix, dataIndx: 'adminfeebasis', cls: 'grayClass' });
                 }
                 else {
                     $grid.pqGrid("addClass", { rowIndx: rowix, dataIndx: 'adminfeebasis', cls: 'grayClass' });
                 }
             },
Title: Re: Dependencies
Post by: paramvir on September 29, 2014, 03:22:14 pm
Take help of cellSave or change event to refresh the corresponding cell in column B in same row whenever value in Column A is changed.
Title: Re: Dependencies
Post by: rgorantla on October 01, 2014, 06:24:24 am
I Used cellClick - so far it is working the way i want - Thank You so much
Title: Re: Dependencies
Post by: paramvir on October 10, 2014, 11:21:31 pm
I'm not sure how you created read only cell with cellClick event. Please check this demo which is relevant to your question

http://paramquery.com/pro/demos/readonly_cells
Title: Re: Read Only Cells
Post by: rgorantla on October 12, 2014, 12:56:38 am
This makes more sense :) - Thank you