Note that there are some explanatory texts on larger screens.

plurals
  1. POData is not getting displayed in dojox.data.Datagrid on click event.
    text
    copied!<p>I want to display data in a data grid. The data is retrieved by a URL using $.get Method as a JSon type. I am not getting any error. But not getting Data grid as well. Here's me script code :: </p> <pre><code>&lt;script type="text/javascript"&gt; $("document").ready(function(){ $('#contentpaneid').bind('click', getInfoFromServer); function getInfoFromServer(){ $.get("http://localhost:8080/2_8_2012/jsp/GetJson.jsp?random=" + new Date().getTime(), function (result) { success:postToPage(result), alert('Load was performed.'); },"Json"); function postToPage(data){ alert(data); var storedata = { identifier:"ID", items: data //[{"ID":1,"Names":"Shantanu","Email":"shantanu.tomar@gmail.com"},{"ID":2,"Names":"Mayur","Email":"mayur.sharma@gmail.com"},{"ID":3,"Names":"Rohit"},{"ID":21,"Names":"Rakesh","Email":"askjhjk"}] }; var store1 = new dojo.data.ItemFileWriteStore({data: storedata}) ; var gridStructure =[[ { field: "ID", name: "ID_Emp", width: "20%", classes:"firstName" }, { field: "Names", name: "Name", width: "20%", classes: "firstName" }, { field: "Email", name: "Mail", width: "20%", classes:"firstName" } ] ]; var grid = new dojox.grid.DataGrid({ store: store1, structure: gridStructure, rowSelector: '30px', selectionMode: "single", autoHeight:true, columnReordering:true },'gridDiv'); grid.startup(); dojo.connect(grid, "onSelectionChanged", grid, function(){ var items = grid.selection.getSelected(); // do something with the selected items dojo.forEach(items, function(item){ var v = grid.store.getValue(item, "Names"); function showDialog() { dojo.require('dijit.Tooltip'); dijit.byId("terms").show(); } showDialog(); }, grid); }); dojo.connect(grid, "onCellClick", grid, function sendmail(){ var items = grid.selection.getSelected(); dojo.forEach(items, function(item){ var v1 = grid.store.getValue(item, "Email"); alert(v1); request.setAttribute("variablemail", v1); }); }); }; }; }); &lt;/script&gt; </code></pre> <p>My markup code is :: </p> <pre><code>&lt;div id="contentpaneid" dojoType="dijit.layout.ContentPane" title="Pending Activities" style="background-image: url('http://localhost:8080/2_8_2012/images/17.png');"&gt; &lt;div data-dojo-id="gridDiv" title="Simple Grid" style="width:900px; height:200px;"&gt; </code></pre> <p>When i click inside content pane I get my alert(data) output as when retrieving data as JSon through $.get method :: </p> <pre><code>[Object object][Object object][Object object](The number of [Object object] depends on number of entries in Database) </code></pre> <p>And output when Retrieving data as Text is :: </p> <pre><code>[{"ID":1,"Names":"Shantanu","Email":"shantanu.tomar@gmail.com"},{"ID":2,"Names":"Mayur","Email":"mayur.sharma@gmail.com"},{"ID":3,"Names":"Rohit"},{"ID":21,"Names":"Rakesh","Email":"askjhjk"},{"ID":22,"Names":"Hello"}] </code></pre> <p>Now when i update the data I do get my data alert ryt. i.e value is getting updated in alert(data) my $.get function is working fine. And also getting alert('Load was performed.') message. But grid is not getting displayed. Its not the data .but grid is also not getting displayed. On click only alert boxes appear. that's it. Where am i making mistake ? And i should retrieved the data as text or JSON so that values are correctly passed on to "items:". please help. i want that on click event the grid refreshes itself according to changes in database. Thanks. </p>
 

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