Note that there are some explanatory texts on larger screens.

plurals
  1. POupdating/refreshing dojo datagrid with new store value on combobox value changes
    primarykey
    data
    text
    <p>I have a combo box and a datagrid in my page. when the user changes the combo box value i have to update the grid with children details of newly selected parent. How can I achieve this using Dojo combo box and datagrid.</p> <p>the following code snippet not working for me. when I use setStore method on the grid with new json data.</p> <pre><code>&lt;div dojoType="dojo.data.ItemFileReadStore" jsId="store" url="/child/index/"&gt;&lt;/div&gt; // grid store &lt;div dojoType="dojo.data.ItemFileReadStore" jsId="parentStore" url="/parent/index/"&gt;&lt;/div&gt; // combo box store </code></pre> <p>//combo box</p> <pre><code>&lt;input dojoType="dijit.form.ComboBox" value="Select" width="auto" store="parentStore" searchAttr="name" name="parent" id="parent" onchange="displayChildren()"&gt; </code></pre> <p>//MY GRID</p> <pre><code>&lt;table dojoType="dojox.grid.DataGrid" jsId="grid" store="store" id="display_grid" query="{ child_id: '*' }" rowsPerPage="2" clientSort="true" singleClickEdit="false" style="width: 90%; height: 400px;" rowSelector="20px" selectionMode="multiple"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th field="child_id" name="ID" width="auto" editable="false" hidden="true"&gt;Text&lt;/th&gt; &lt;th field="parent_id" name="Parent" width="auto" editable="false" hidden="true"&gt;Text&lt;/th&gt; &lt;th field="child_name" name="child" width="300px" editable="false"&gt;Text&lt;/th&gt; &lt;th field="created" name="Created Date" width="200px" editable="false" cellType='dojox.grid.cells.DateTextBox' datePattern='dd-MMM-yyyy'&gt;&lt;/th&gt; &lt;th field="last_updated" name="Updated Date" width="200px" editable="false" cellType='dojox.grid.cells.DateTextBox' datePattern='dd-MMM-yyyy'&gt;&lt;/th&gt; &lt;th field="child_id" name="Edit/Update" formatter="fmtEdit"&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;/table&gt; </code></pre> <p>//onchange method of parent combo box in which i am trying to reload the grid with new data from the server.</p> <pre><code>function displayChildren() { var selected = dijit.byId("parent").attr("value"); var grid = dojo.byId('display_grid'); var Url = "/childsku/index/parent/" + selected; grid.setStore(new dojo.data.ItemFileReadStore({ url: Url })); } </code></pre> <p>But it's not updating my grid with new contents. I don't know how to refresh the grid every time users changes the combo box value. </p> <p><strong>I would be glad if I get the solution for both ItemFileReadStore and ItemFileWrireStore.</strong></p>
    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.
 

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