ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: mshapiro on July 28, 2015, 05:46:48 am

Title: Using addClass to turn a row of string cells into numeric input cells (2.4.1)
Post by: mshapiro on July 28, 2015, 05:46:48 am
I have a grid of string columns, it gets populated with one empty row.  I then use addclass to turn this row into input cells using

$gridAnalysis.pqGrid("addClass", { rowIndx: 1, cls: 'pq-delete pq-edit' });

I would like to restrict the input to numeric values.  Is there another class that can be added or another way to turn just these cells into integer type?  I would also like to know what classes other than pq-delete and pq-edit are available.

On a similar note, I recently got a response to an issue I posted where the answer was to use refresh: false as an argument to updateRow().  That solved my issue, but I don't see this argument in the documentation for updateRow().  I suspect there are other arguments to other methods that I don't know about that could be very useful.  Where can find all of this?  Thanks.
Title: Re: Using addClass to turn a row of string cells into numeric input cells (2.4.1)
Post by: paramvir on July 28, 2015, 03:22:46 pm
numeric values are restricted to cells when the column has dataType = "float" or "integer". Since you want to mix strings with numbers in the same column, you could use editorBegin event to switch dataType of the column.

Code: [Select]
            editorBegin: function(evt, ui){
                if( some condition based on ui.rowIndx, ui.rowData, ui.dataIndx ){
                    ui.column.dataType = "float";
                }               
            },


pq-row-edit and pq-row-delete are not inbuilt classes but they are used as a means to define meta data of rows in editing demos to mark the editable rows or define style of to-be deleted row.

Row editable logic lies in the editable callback used in this demo http://paramquery.com/pro/demos/editing

 editable: function (ui) {
                var $grid = $(this);
                var rowIndx = ui.rowIndx;
                if ($grid.pqGrid("hasClass", { rowIndx: rowIndx, cls: 'pq-row-edit' }) == true) {
                    return true;
                }
                else {
                    return false;
                }
            },


Quote
answer was to use refresh: false as an argument to updateRow().  That solved my issue, but I don't see this argument in the documentation for updateRow().

The documentation is being updated in this regard. I would let you know once done.
Title: Re: Using addClass to turn a row of string cells into numeric input cells (2.4.1)
Post by: paramvir on August 04, 2015, 12:44:37 am
Topic on performance in relation to view refresh has been mentioned here:

http://paramquery.com/pro/tutorial#topic-performance