This question is locked. New answers and comments are not allowed.
I have the following mvc grid which binds using ajax called from JavaScript. Everything displays properly.
Two questions
- How do I set the scrolling height of the grid in JavaScript
- How do I scroll the grid back to the top in JavaScript
Grid
<%=Html.Telerik().Grid(Model.Details.Data) .Name("AlertGrid") .Sortable(sorting=> sorting.SortMode(GridSortMode.SingleColumn)) .Ajax(ajax =>ajax.Action("GetAlertDetails", "AlertOpenOrderDetail", new {dcId=Guid.Empty.ToString(), alertType=-1})) .Scrollable(scrolling => scrolling.Height(450)) .Columns(columns=> { columns.Add(o=> o.AlertType).Title(string.Empty).Width(30); columns.Add(o=> o.CustomerNumberDisplay).Title("Cust #").Width("11%"); columns.Add(o=> o.CustomerName).Title("Customer").Width("20%"); columns.Add(o=> o.DeliveryDateDisplay).Title("Delivery").Width("9%"); columns.Add(o=> o.ProductNumber).Title("Prod #").Width("6%"); columns.Add(o=> o.Brand).Title("Brand").Width("6%"); columns.Add(o=> o.PackSize).Title("Size").Width("8%"); columns.Add(o=> o.ProductDescription).Title("Description").Width("30%"); columns.Add(o=> o.AlertTypeDescription).Title("Alert").Width("10%"); columns.Add(o=> o.MonitorOrderDetailAlertId).Visible(false); }) .ClientEvents(events => events .OnRowDataBound("onRowDataBound") ) %>JavaScript
function bindGrid() { showWait(); var grid= $('#AlertGrid').data('tGrid'); var dcIdVal = $('#DcId').val(); var alertTypeVal = $('#AlertType').val(); grid.rebind({dcId: dcIdVal, alertType: alertTypeVal }); hideWait();}