Author Topic: Using addClass to turn a row of string cells into numeric input cells (2.4.1)  (Read 2858 times)

mshapiro

  • Pro Enterprise
  • Newbie
  • *
  • Posts: 35
    • View Profile
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.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
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.
« Last Edit: July 28, 2015, 05:13:55 pm by paramquery »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Topic on performance in relation to view refresh has been mentioned here:

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