2014年7月13日 星期日

[RESOLVED] Custom values in kendo grid "Items per page" dropdown


Hi, I have a kendo grid with several 1000's of rows. I want to display them as 1000 per page. Can any one please tell me how can I make the dropdown customized with the values like 1000, 5000, 10000 etc. and display number of rows based on it in javascript
or JQuery.



Any help appreciated!



Hi,


According to your description, you want to page the kendo Grid control and the pagesize comes from the DropDownList control's selected value. So far as I know, if we want to set 1000,5000,10000 as the datasource of the DropDownList control, please refer
to the code below:


$("#parent").kendoDropDownList({
dataTextField: "PageSize",
dataValueField: "SizeValue",
dataSource: [
{ PageSize: "Size1", parentId: 1000 },
{ PageSize: "Size2", parentId: 5000 },
{ PageSize: "Size3", parentId: 10000 },
]
});

For more information about kendoDropDownList, please refer to the link below:


http://docs.telerik.com/kendo-ui/api/web/dropdownlist


If you want to page the kendo Grid, please refer to the code below:


$("#parent").kendoDropDownList({
dataTextField: "PageSize",
dataValueField: "SizeValue",
dataSource: [
{ PageSize: "Size1", parentId: 1000 },
{ PageSize: "Size2", parentId: 5000 },
{ PageSize: "Size3", parentId: 10000 },
],
change: function(e) {
var grid = $("#grid").data("kendoGrid");
grid.dataSource.pageSize(parseInt(this.value())); // this.value() being the value selected in Combo
}

});

For more professional support, please refer to kendo forum as below link:


http://www.telerik.com/forums


Hope it's useful for you.


Best Regards,


Michelle Ge




Thanku Michelle!. But I found the solution..


I used:


pageable: {
pageSize: 1000,
pageSizes: [1000, 5000, 10000]
}


Hi,


Can we create Kendo ui grid fields on condition- like if the mode==1 then there shud be 4 field else there shud be 6 fields?



沒有留言:

張貼留言