I have a hierarchal grid that's mostly doing what I want, however, paging and scrolling are not working as expected. I'm using AJAX binding. It doesn't seem to matter what I set pageSize to in the DataSource section; the presentation doesn't change much, only the number of page buttons for example. In my current scenario I have 12 rows in the 2nd level grid, and a pageSize of 6. Scrolling is turned on. The grid allows me to scroll through all 12 rows, but what I expected was that I could use the page buttons to advance. I tried turning scrolling off and it kept right on scrolling the entries. This is very curious, and not at all what I expected. The following shows my grid markup (RAZOR format):
@(Html.Kendo().Grid(Model)
.Name("BatchGrid")
.Pageable()
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "height:525px; width:1200px" })
.Columns(columns =>
{
columns.Bound(b => b.BatchID)
.Width("300px")
.Title("Batch ID")
.Visible(false);
columns.Bound(b => b.ShortBatchID)
.Width("100px")
.Title("Batch ID");
columns.Bound(b => b.HasErrorTransaction)
.Width("50px")
.Title("Err").Visible(false);
columns.Command(c => c.Custom("Post Batch")
.Click("onClickPostBatch")
.HtmlAttributes(new { style = "width:100px;" }));
columns.Bound(b => b.Created_Emp_Name)
.Width("200px")
.Title("Created Employee");
columns.Bound(b => b.Transmitted_DateTime)
.Width("175px")
.Format("{0:MM/dd/yyyy hh:mm tt}")
.Title("Transmitted");
columns.Bound(b => b.Completed_DateTime)
.Width("175px")
.Format("{0:MM/dd/yyyy hh:mm tt}")
.Title("Completed");
columns.Command(c => c.Custom("Delete Batch")
.Click("onClickDeleteBatch")
.HtmlAttributes(new { style = "width:100px;" }));
}
)
.DataSource(dataSource => dataSource
.Ajax()
.Sort(sort => sort.Add("HasErrorTransaction").Ascending()) // <-- initial sort
.PageSize(12)
.Read(read => read.Action("FetchBatchCollection", "Home").Data("addlData"))
.ServerOperation(false)
)
.Events(events => events.DataBound("onBatchGridDataBound")
.DetailExpand("onBatchGridExpand"))
.ClientDetailTemplateId("transactions")
)
<!-- Nested grid for transaction object, member of BatchHeader.TranCollection
There can be many ITransaction objects per BatchHeader -->
<
script
id
=
"transactions"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
ROAMTranReview.ROAMHostSvc.TransactionBase
>()
.Name("TranGrid_#=BatchID#") // makes the sub-grid name unique so that it will be displayed on each child row.
.HtmlAttributes(new { style = "height:535px; width:1400px" })
.Columns(columns =>
{
columns.Bound(b => b.BatchID)
.Visible(false);
columns.Bound(b => b.TransactionType)
.Visible(false);
columns.Bound(b => b.ID)
.Width("300px")
.Title("Transaction ID")
.Visible(false);
columns.Bound(b => b.ShortTranID)
.Width("100px")
.Title("Tran ID");
columns.Command(c => c.Custom("View Transaction")
.Click("onClickViewTransaction")
.HtmlAttributes(new { style = "width:100px;" }));
columns.Bound(b => b.TranTypeDisplayText)
.Width("100px")
.Title("Type");
columns.Bound(b => b.ItemID)
.Width("100px")
.Title("Item ID");
columns.Bound(b => b.ItemDescription)
.Width("300px")
.Title("Item Description");
columns.Bound(b => b.Quantity)
.Width("50px")
.Title("Qty");
columns.Bound(b => b.WorkOrderTask)
.Width("100px")
.Title("Workorder");
columns.Bound(b => b.EmployeeName)
.Width("200px")
.Title("Employee");
columns.Command(c => c.Custom("Delete Transaction")
.Click("onClickDeleteTransaction")
.HtmlAttributes(new { style = "width:155px;" }));
columns.Bound(b => b.PostingFlagDisplayText)
.Width("150px")
.Title("Posting Flag");
})
.Scrollable()
.Pageable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("FetchTransactionCollection", "Home", new { batchID = "#=BatchID#" }))
)
.Events(events => events.DataBound("onTranGridDataBound")
.DetailExpand("onTranGridExpand"))
.ToClientTemplate()
)
</
script
>