Note that there are some explanatory texts on larger screens.

plurals
  1. POJQGrid - SetRowData - Returns success but no data updated
    primarykey
    data
    text
    <p>I am trying to add/edit data into my JQGrid. Currently the first column is populated and then the other six are blank and are dependent upon the first column. So I need to <strong>add or "edit the blank" the data in the other six columns while the first remains the same.</strong> </p> <p>Right now I am just trying to get access into the JQGrid to edit my current data. The function below is what I have setup so far. It gets passed the time (the first columns data), the number of ohms (data to enter the grid), and the column name. It builds my data set and then tries to add it to rowid 0. This is hardcoded just because I'm trying to get it to work right now. Then I access the JQGrid, add the rowdata and it actually returns a success, but nothing has been added to the JQGrid.</p> <p>*note - this is all done within my javascript file</p> <pre><code>function AddRow(elapsedTime, numMOhms, mColumn) { switch(mColumn) { case 'a': case 'A': dataToAdd = [{TestTime:elapsedTime,RdgA:numMOhms,CorrA:"",RdgB:"",CorrB:"",RdgC:"",CorrC:""}]; break; case 'b': case 'B': dataToAdd = [{TestTime:elapsedTime,RdgA:"",CorrA:"",RdgB:numMOhms,CorrB:"",RdgC:"",CorrC:""}]; break; case 'c': case 'C': dataToAdd = [{TestTime:elapsedTime,RdgA:"",CorrA:"",RdgB:"",CorrB:"",RdgC:numMOhms,CorrC:""}]; break; } alert(JSON.stringify(dataToAdd)); var success = jQuery("#polarizationTable").jqGrid('setRowData',0,dataToAdd[0]); if(success) { alert("y"); } DrawGraph(true); } </code></pre> <p>if you replace the last bit with this:</p> <pre><code>for(var i=0;i&lt;=dataToAdd.length;i++) jQuery("#polarizationTable").jqGrid('addRowData',i+1,dataToAdd[i]); </code></pre> <p>I can get it to add, but it is a dumb add and just appends that data to the end instead of updating data in that row. I tried modifying it with hardcode and removing the for loop, and no luck.</p> <p>Here is what my colModel/colNames looks like.</p> <pre><code>colNames:['Minutes','Reading A', 'Corr A', 'Reading B','Corr B','Reading C','Corr C'], colModel:[ {name:'TestTime',index:'TestTime', align:"center", sortable:false}, {name:'RdgA',index:'RdgA', align:"center", sortable:false}, {name:'CorrA',index:'CorrA', align:"center", sortable:false}, {name:'RdgB',index:'RdgB', align:"center", sortable:false}, {name:'CorrB',index:'CorrB', align:"center", sortable:false}, {name:'RdgC',index:'RdgC', align:"center", sortable:false}, {name:'CorrC',index:'CorrC', align:"center", sortable:false} ], </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload