jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Paging issue in jqxgrid
Tagged: datagrid paging
This topic contains 5 replies, has 3 voices, and was last updated by Kumari Aruna 11 years, 4 months ago.
-
AuthorPaging issue in jqxgrid Posts
-
Hi
I am trying to enable paging in my grid control. Only few items will be load first. And the next items will be load from server when user clicks next or when entering a new page number. The data i am sending from controller to view as json string format(Not a list).
For. Ex:string data = [{“DocNumber”:”TPIA Audit Report Dodsal format”,”DocDesc”:”TPIA Audit Report Dodsal format”},{“DocNumber”:”Habshan Sulphur Granulation_June 11″,”DocDesc”:”Habshan Sulphur Granulation_June 11″}]
I am giving a sample of my actual code for binding the grid.
var customrow='';
var source = {
datatype: "json",
//type : "GET",
datafields: [
{ name: 'DocNo', map: 'DocNo', type: 'string' }, //it will be dynamic
{ name: 'DocDesc', map: 'DocDesc', type: 'string' },
],
url: '/Student/GetDocuments?folderid=1000',
root: 'Rows',
beforeprocessing: function (data1) {
debugger;
source.totalrecords = data1.TotalRows;
//customrows = data.AllRecords;
}
};var dataadapter = new $.jqx.dataAdapter(source, {
loadError: function (xhr, status, error) {
alert(error);
}
});$("#jqxgrid").jqxGrid({
source: dataadapter,
autoheight: true,
pageable: true,
virtualmode: true,rendergridrows: function () {
return $.parseJSON(dataadapter.records); // here i am geting array of uid 0, uid 1 etc. Not the actual data.
},
columns: [{ text: 'Documenty Number', datafield: 'DocNo', width: 200 }, //it will be dynamic
{ text: 'Document Descr', datafield: 'DocDesc', width: 180 }
]
});
In dataadapter.records i am getting some list [[0] uid 0, [1] uid 1, [2] uid 3 etc] not the actual data. How can i solve the issue. I am not able to send the list from controller because my data, columns etc is dynamic.Regards
DominicHi Dominic,
For paging in Virtual mode, take a look at the jqxGrid’s Virtual Data sample and the Server Paging samples in the PHP Integration demos. The rendergridrows should return Array and that Array should contain the data that should be displayed on the Grid and that data should depend on the indexes requested by the Grid as shown in the samples.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Dear Peter Stoev,
Thank you for your response.
Since my all columns are dynamic, I can’t create an array. So I can send only json string to the server.
Is it possible to override the default behavior?I.E.
1. Load the first page data initially [Binding json string to grid]
2. When the user clicks the next page, I will call a controller method with arguments as page number and page size and rebind the next page data [json string] to the grid.If it is possible, in which event (rendergridrows, pagerenderer, pagechanged etc) I should call my controller method to invoke the next page data and how do I bind the grid (or refresh the grid) with the new data.
Regards
DominicHi Dominic,
There is no problem to use Server Paging, the problem is in the way it is used in the provided code. An Array is expected to be returned by the “rendergridrows” callback function. The first item in the array should be with Start index requested by the Grid. The second item should be with Start Index + 1 reqested by the Grid and so on. If an Array in the Expected format(Object with key-value pairs where the key is the column’s datafield and the value is the cells’value) is not returned, the Grid will not display the data. Please, look at the demos regarding Server Paging for learning how to use the feature.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comDear Peter Stoev
Thank you for the information. It worked when i used key value pair [Collection of dictionary]. But my grid filtering is not working. I set both the showfilterrow : true and filterable: true. I can see the filter row but it is not filtering based on by input (at least in the loaded data ). How can i solve this issue.
Regards
DominicHi,
I want to show 100 rows per page in a grid by default, but In “Show rows” drop down “100” is not fully visible(i.e Half visible(10 only)) .
So I did
.jqx-dropdownlist-content {
width:23px !important
}
but this is decreasing the drop down heights of my filters applied on the grid columns as well .Is there any way to increase only the size of show rows “dropdown”?
Aruna
-
AuthorPosts
You must be logged in to reply to this topic.