I’m currently using a dojo datagrid and I want to be able to loop through a list containing all the value for each field of the grid. For example say my grid has these columns:
<th field="name" width="200px">Name</th>
<th field="description" width="200px">Description</th>
<th field="type" width="200px">Type</th>
How do I get a list of all the field values? With this example, the list should be [name, description, type]. Thanks for any help!
Let’s try this.
First, you need to know the ID of the dijit. If it’s autogenerated (because you are declaring your DataGrid in HTML), you may need to use
dojo.queryto find the DOM node, and usedijit.byNode(node)to locate the dijit. The example below assumes you know the ID.This will recursively process the structure of the Grid, looking for any object with a
fieldproperty.Update I had to add in a check for
object.cellsfor declarative grids.