abrown31

Checking a row selects the given feature - Datagrids and checkboxes

Discussion created by abrown31 on Jun 2, 2011
Hi All,

I'm dynamically creating a dojo datagrid, specifically an enhanced grid, depending on what feature class i'm searching against in my search tool. The search results are populated in this dynamic table in a static div. I am using the indirectSelection plugin, which enables me to have checkboxes in the first column of each row.

Once the search results are populated in the table, every row in the table is automatically checked and every feature on the map is selected.

How do I tie the checkboxes to the current selection? So if I uncheck a row, it's unchecked from the map, and vice versa? I can currently uncheck a box, but the feature is still selected on the map.

Thanks!!!

Code below:

searchGrid = new dojox.grid.EnhancedGrid({
          query: {
            OBJECTID: '*'
          },
          store:store,
          clientSort:true,
          rowSelector:'20px',
          structure:fieldNameArr,
          plugins: {
            indirectSelection: true
          }
        });
        dojo.byId("searchTab").appendChild(searchGrid.domNode);
        searchGrid.startup();
        searchGrid.rowSelectCell.toggleAllSelection(true);

Outcomes