jQuery UI Widgets › Forums › Grid › No Data Display in Grid
Tagged: jqx grid
This topic contains 5 replies, has 2 voices, and was last updated by Amar Kansara 10 years, 3 months ago.
-
AuthorNo Data Display in Grid Posts
-
Hi Expert,
I am facing trouble in displaying data in grid. My table contains more than 26000 records and I am binding grid to those data using webmethod.
On the Data Presenting web method, when I try to display full table the grid failed to display data, but if I reduce the number of records to 7285 records, working perfect but anything above this will not work..
Please guide.
With so high number of records, you might be facing jsonresult size limitations. Check the http traffic with Fiddler or with brower’s network traffic monitor. I have few experience in asp.net clasic, but this might help you:
http://stackoverflow.com/questions/4179986/asp-net-webmethod-with-jquery-json-is-there-a-size-limit. In MVC LargeJsonResult is the answer.
Still, in such cases client’s resources should also be considered. IE for example is not dealing well with to many rows, loosing considerable responsiveness.
So I suggest you to switch your grid tovirtualmode
. The most complex demo is here (not Linq based tough), but you should check the others too.Hello Zorgoz,
Thanks for the reply. My problem still persists.
My Web Method that caters data
[WebMethod]
[ScriptMethod(UseHttpGet = true, ResponseFormat = ResponseFormat.Xml)]
public static string GetCustomer()
{
string query = “SELECT Top 7200 Histrycode, ChsNo, RegNo, CustNm, Address, CITY FROM History”;
SqlCommand cmd = new SqlCommand(query);
// Populate the DataSet.
DataSet data = GetData(cmd);
// return the Customers table as XML.
System.IO.StringWriter writer = new System.IO.StringWriter();
data.Tables[0].WriteXml(writer, XmlWriteMode.WriteSchema, false);
return writer.ToString();
}My Code to generate Grid is;
var SourceR =
{
datatype: “xml”,
datafields: [
{ name: ‘Histrycode’ },
{ name: ‘ChsNo’ },
{ name: ‘RegNo’ },
{ name: ‘CustNm’ },
{ name: ‘Address’ },
{ name: ‘CITY’ }
],
async: false,
record: ‘Table’,
url: “DataColl.aspx/GetCustomer”
};
var CustDA = new $.jqx.dataAdapter(SourceR,
{
contentType: ‘application/json; charset=utf-8’
});
CustDA.dataBind();
var editrow = -1;// initialize jqxGrid
$(“#jqxDet”).jqxGrid(
{
theme: ‘energyblue’,
width: 800,
source: CustDA,
showfilterrow: true,
filterable: true,
selectionmode: ‘multiplecellsextended’,
columns: [
{ text: ‘Select’, filtertype: ‘none’, datafield: ‘Edit’, columntype: ‘button’, cellsrenderer: function() { return “Edit”; },
buttonclick: function(row) {
editrow = row;
}
},
{ text: ‘Hist Code’, datafield: ‘Histrycode’, width: 90, hidden: true },
{ text: ‘Chassis No’, columntype: ‘textbox’, filtertype: ‘input’, datafield: ‘ChsNo’, width: 150 },
{ text: ‘Reg. No’, columntype: ‘textbox’, filtertype: ‘input’, datafield: ‘RegNo’, width: 150 },
{ text: ‘Customer Name’, columntype: ‘textbox’, filtertype: ‘input’, datafield: ‘CustNm’, width: 250 },
{ text: ‘Address’, filtertype: ‘none’, datafield: ‘Address’, width: 150 },
{ text: ‘City’, filtertype: ‘none’, datafield: ‘CITY’, width: 150 }
]
});Setting virtualmode to true didn’t solved the problem.
I will check the rest soon and revert.
Amar
Hello Zorgoz,
In connection to your reply, I’ve checked the topics on the link supplied by you, but nothing has helped me.
Amar
Simply setting virtualmode to true won’t help. As you can see on the page linked last in my post (here again), you have to change much more in you grid related javascript code. You can find many other topics related to virtualmode on this page.
Have you tried to debug the http traffic – does your xml data arrive to the client side completely? Is it well formed? How big is the response content?
You seem to mix xml and json somehow. And why do you send the schema anyway? Ok, I see, you got this from here, but looks odd to me…
For me it is quite clear, you have a performance/resource related issue if you can return 7000 but not 26000. As in general the server is far from the client, and the client has limited resources, sending 26000 rows as a single xml is not really an option in a production environment – even if it does work. Less if doesn’t. So I suggest you re-check the link from above about virtualmode. It will work.
Just a note. Why don’t you return json from the webmethod at first place? It looks straightforward, but using DataSet is a huge overhead. Have a look here. Just make sure to have proper transaction isolation. Or try this one, even if you omit filtering. It might even work with all those records, since json format is much more compact than xml.
Still, in virtualmode you either use paging or not, you will have to filter returned data, since you will need to send only few records at once.Hello Zorgoz,
Thanks for all efforts in solving the problem. I solved it different way. Actually, the problem was with my data, the resulting table contains some junk characters, which was effecting the XML result pushed to Source and hence DataAdaptor.
Regards
Amar -
AuthorPosts
You must be logged in to reply to this topic.