Title: Filling a DataGrid with JSON data Post by: zamubal on September 28, 2011, 12:09:07 PM I am trying to set up a datagrid which will display data from the server but the datagrid is not displaying the data from the server. The data is a JSON string. See below for the string and for the datagrid setup. Using FireBug I can see that the data is request from the server and the JSON string is returned but the datagrid does not display anything. I get a JavaScript error saying "data is null" or "_438 is null".
I validated the JSON string online and it was shown as been valid according to http://jsonlint.com/. I am using the latest version of JEasyUI. JSON Data String Code: [{"id":1,"userId":1,"fieldName":"FIELD_1","fieldValue":"20006683","operator":"=","openPar":"(","closePar":")","andOr":"AND"},{"id":2,"userId":1,"fieldName":"FIRST_NAME","fieldValue":"JOHN","operator":"=","openPar":"(","closePar":")","andOr":"AND"}] DataGrid setup Code: <table id="filterTable" title="Filter Options" class="easyui-datagrid" Title: Re: Filling a DataGrid with JSON data Post by: fcodebue on September 28, 2011, 01:31:01 PM do you have javascript istructions like these?
Code: $(document).ready(function() { Title: Re: Filling a DataGrid with JSON data Post by: zamubal on September 28, 2011, 02:11:08 PM Thank you for the response. I did find out the problem.
I was automatically initializing the datagrid by using class="easyui-datagrid" in the table tag. I also had the JavaScript call $('#filterTable').datagrid(); in one of my JavaScript files. Because the JavaScript call did not have any attributes defined, no data was been added to the datagrid. Title: Re: Filling a DataGrid with JSON data Post by: fcodebue on September 29, 2011, 07:47:42 AM Thank you for the response. I did find out the problem. I was automatically initializing the datagrid by using class="easyui-datagrid" in the table tag. I also had the JavaScript call $('#filterTable').datagrid(); in one of my JavaScript files. Because the JavaScript call did not have any attributes defined, no data was been added to the datagrid. Usually I use to specify all properties into javascript code and so there are no problems. Try it... |