Batch editing of rows

LabKey Support Forum
Batch editing of rows Mark2  2015-03-27 09:18
Status: Closed
 
HI

I was wondering if someone can show me or point to an example for implementing batch editing of rows in a grid or batch editing by using the survey or another simple means.

Say I selected 5 rows from a grid for example and wanted to add in the same information for every field for each of those 5 rows, I was wondering can that be done in a grid by selection and then batching editing via a form or something else?

I have a grid embedded into a wiki the code as below but dont know if or how it can be extended so it can run in batch editing mode and update or edit a selection of rows instead of one row at a time.

Thanks in advance again


<script type="text/javascript">
    var _grid;

    //use the Ext.onReady() function to define what code should
    //be executed once the page is fully loaded.
    //you must use this if you supply a renderTo config property
    Ext.onReady(function(){
        _grid = new LABKEY.ext.EditorGridPanel({
            store: new LABKEY.ext.Store({
    schemaName: '$schemaName',
containerPath: '$containerPath',
 columns: 'Subject ID,Time Point,Microarray comm',
        queryName: '$queryName'
            }),
            renderTo: 'grid',
            width: 1200,
            height: 100,
            autoHeight: true,
            enableFilters:true,
        pageSize:10,
            editable: true
        });
    });
</script>
<div id='grid'/>
 
 
Jon (LabKey DevOps) responded:  2015-03-30 11:33
Hi Mark,

Although we don't have any example code, to pull off batch editing the way you describe, you would have to have your code do the following:

1. Collect the specific ID numbers of the rows that you want to edit and save them in an array.
2. Have your code only identify fields that you want to update.
3. Have your code then use the javascript API to do an updateRows (https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Query.html#.updateRows) or saveRows (https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Query.html#.saveRows) on a loop, using the array from earlier.

Does this make sense?

Regards,

Jon
 
Mark2 responded:  2015-03-30 13:07
Thanks Jon for your email, yes this makes sense, just checking what was available.


Thanks again, closing case.