or
I am building a TabStrip where the content of the tabs is rendered from partial views. Each tab has a grid with its own datasource. I assumed that the content for each tab would not be loaded until the tab is clicked for the first time, but what I am experiencing is that all the data for all the tabs is being hit when the TabStrip is initially loaded. Am I missing something?
TabStrip declaration:
@(Html.Kendo().TabStrip() .Name("AssetDetails") .Items(tabstrip => { tabstrip.Add().Text("Asset Review") .Selected(true) .Content(@Html.Partial("_AssetReview", Model).ToHtmlString()); tabstrip.Add().Text("Closing") .Content(@Html.Partial("_Closing").ToHtmlString()); tabstrip.Add().Text("Occupancy") .Content(@Html.Partial("_Occupancy").ToHtmlString()); tabstrip.Add().Text("Eviction") .Content(@Html.Partial("_Eviction").ToHtmlString()); tabstrip.Add().Text("Property Management") .Content(@Html.Partial("_PropertyManagement").ToHtmlString()); tabstrip.Add().Text("Purchase Order") .Content(@Html.Partial("_PurchaseOrder").ToHtmlString()); tabstrip.Add().Text("Marketing") .Content(@Html.Partial("_Marketing").ToHtmlString()); tabstrip.Add().Text("Field Inspection") .Content(@Html.Partial("_FieldInspection").ToHtmlString()); tabstrip.Add().Text("Property Inspection") .Content(@Html.Partial("_PropertyInspection").ToHtmlString()); }))
Closing partial view:
@(Html.Kendo().Grid<Atlas.Core.Objects.PortalAssetClosing>() .Name("gridClosing") .Columns(columns => { columns.Bound(p => p.ClosingStatusName); columns.Bound(p => p.BuyerName); columns.Bound(p => p.ContactName); columns.Bound(p => p.LenderContactName); columns.Bound(p => p.AcceptanceDate).Title("Acceptance Date").Width(100).Format("{0:MM/dd/yyyy}"); columns.Bound(p => p.ActualCloseDate).Title("Close Date").Width(100).Format("{0:MM/dd/yyyy}"); columns.Bound(p => p.CancelledDate).Title("Canceled Date").Width(100).Format("{0:MM/dd/yyyy}"); columns.Bound(p => p.EstimatedCloseDate).Title("Estimated Close Date").Width(100).Format("{0:MM/dd/yyyy}"); }) .Sortable() .Pageable(x => x.PageSizes(new[] { 25, 50, 100 })) .Scrollable() .DataSource(dataSource => dataSource .Ajax() .PageSize(5) .Read(read => read.Action("GetData_Read", "AssetClosing").Data("additionalData")) ))When the tabstrip is rendered for the first time, the selected tab is the Asset Review tab, but the datasource for the Closing tab is also being hit.
I don't want the closing tab grid to hit the database until the tab is selected for the first time.
How do I set up the TabStrip to be LoadOnDemand?
var xml = '<ROWS><ROW id="1"><CARD>1</CARD><LLINE>1</LLINE></ROW><ROW id="2"><CARD>1</CARD><LLINE>2</LLINE></ROW></ROWS>';$(document).ready(function() { $('#gridDiv').kendoGrid({ columns: [ { field: 'CARD', title: 'Card', width: 60 },{ field: 'LLINE', title: 'Line', width: 60 } ], dataSource: new kendo.data.DataSource({ type: 'xml', data: xml, schema: { type: 'xml', data: '/ROWS/ROW', model: { id: 'id', fields: { id: '@id', CARD: 'CARD/text()', LLINE: 'LLINE/text()' } } } }) });});