FAQs
Search
Recent Topics
Flagged Topics
Hot Topics
Best Topics
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
HTML Pages with CSS and JavaScript
loading data from dojo rpc to dojo datagrid
Ahmed M. Omar
Ranch Hand
Posts: 43
posted 10 years ago
i made a remote procedure call to a
struts
2 action using dojo and it returns data successfully from the action
the next step is to put this data to a dojo datagrid i wrote the following code
<%@ taglib prefix="s" uri="/struts-tags" %> <script type="text/javascript"> var djConfig = { isDebug: true }; </script> <script src="../script/dojo/dojo.js.uncompressed.js" type="text/javascript"></script> <script type="text/javascript"> dojo.require("dojo.io.iframe"); dojo.require("dojo.io.script"); dojo.require("dojo.rpc.JsonpService"); dojo.require("dojo.rpc.JsonService"); dojo.require("dojo.rpc.RpcService"); dojo.require("dojox.grid.DataGrid"); dojo.require("dojox.data.CsvStore"); dojo.require("dojo.data.ItemFileReadStore"); </script> <s:url id="smdUrl" namespace="/nodecorate" action="RpcAction"/> <script type="text/javascript"> var service = new dojo.rpc.JsonService("${smdUrl}"); </script> </table> <table id="gridNode" jsId="grid" dojoType="dojox.grid.DataGrid" query="{ empName: ‘*’ }" store="jsonStore"> <thead> <tr> <th field="empName">Employee Name</th> </tr> </thead> </table> <button onclick="refreshData();">Search</button><br> <script type="text/javascript"> refreshData = function() { var rowsCallback = function(emps) { var jsonStore = new dojo.data.ItemFileReadStore({ url: emps }); var grid = new dojox.grid.DataGrid({ id: 'grid', query: { empName: '*' }, store: jsonStore, structure: layout }, 'gridNode'); }; var deferred = service.rpcMethod(); deferred.addCallback(rowsCallback); } dojo.addOnLoad(function() { refreshData(); }); </script>
in the following line
var rowsCallback = function(emps)
the emps is a json array and at this point the data is arrived perfectly
i want to put the elements of the array to the datagrid
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Need help on understanding ww:token
dojo loading FilteringTable problem
dojo loading FilteringTable problem
DOJO Grid and JSON
table columns not sorted by Tablekit after AJAX call and <div> is added
More...