Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may find what you're looking for by using <code>Selection</code> mixin provided by dGrid. Using <code>Selection</code>, you can define your grid like this:</p> <pre><code> grid = new (declare([OnDemandGrid, Selection]))({ store: Observable(Memory({ // replace with your store of choice idProperty: 'id' })), columns: { /* your columns layout */ }, noDataMessage: 'No results found.', loadingMessage: 'Loading data...' }); grid.startup(); </code></pre> <p>In your columns object, you can define a column that uses a function called <code>renderCell</code> that looks like this:</p> <pre><code> renderCell: function (object, value, node, options) { // Object is the row; i.e., object's properties are the column names // value is the value for this cell // node is the DOM node of this cell // Not sure what 'options' refers to } </code></pre> <p>When a row is selected, you can retrieve the row by using the <code>grid.selection</code> property, which is an object that contains key/value pairs where the the ID's (based on <code>idProperty</code>) are the keys. The value for each key contains a boolean that indicates whether or not that particular row is selected. So, to get each selected row, you could do something like:</p> <pre><code> for (selectedId in selection) { if (selection.hasOwnProperty(selectedId) &amp;&amp; selection[selectedId] === true) { var selectedRow = grid.row(selection[selectedId]; ... // and so on... } } </code></pre> <p>None of this specifically gives you the row index, but you may be able to figure it out from here using your browser's Development Tools (e.g., Firebug for Firefox, etc).</p>
    singulars
    1. This table or related slice is empty.
    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.
    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