ParamQuery grid support forum

General Category => ParamQuery Pro Evaluation Support => Topic started by: rallesaid on September 13, 2016, 03:07:43 am

Title: addRow when editable = false
Post by: rallesaid on September 13, 2016, 03:07:43 am
Hi, i have a question,
when I add a new row whit a default value in a column 'editable:false', I add in addRow({checkEditable:false}) and the row is added whitout problem, but when i add a second row, i get this error "Uncaught primary key violation", but if i remove checkEditable:false or replace whit checkEditable:true, then i can add unlimited rows, but the default values of the column 'editable:false' is not added, how i can add multiples row whit a default value when column editable is false?
thanks :)
Title: Re: addRow when editable = false
Post by: paramvir on September 13, 2016, 08:33:14 am
primary key violation error is thrown when you try to enter duplicate values in a primary field. ( dataModel.recIndx )

Only unique values can be entered in primary key fields.
Title: Re: addRow when editable = false
Post by: rallesaid on September 13, 2016, 05:08:05 pm
but the new row that I add, did not add any recIndx, only added a fact to another column editable:false, obviously my column recIndx is also editable: false
Title: Re: addRow when editable = false
Post by: rallesaid on September 13, 2016, 06:19:10 pm
I solve whit this code:

var rowData = {indx1:'data1',index2:'data2'} //assuming indx1 and indx2 editable:false

var rowIndx = grid.addRow({
        newRow:{},                         //add void row
        rowIndx: 0,                          //at first row
        checkEditable:true
    });
var pdata = grid.pdata[0];          //get the grid data at position 0

for(i in rowData){
     pdata = rowData;           //set values of my rowData
}

grid.refreshRow({rowIndx:0})    //refresh the row