or
<div id=
"grid"
></div>
<script type=
"text/javascript"
>
var
dateRegExp = /^\/Date\((.*?)\)\/$/;
function
toDate(value) {
var
date = dateRegExp.exec(value);
return
new
Date(parseInt(date[1]));
}
$(document).ready(
function
() {
var
url =
'@Url.Action("Grid")'
;
var
dataSource =
new
kendo.data.DataSource({
serverPaging:
true
,
serverSorting:
true
,
serverFiltering:
true
,
pageSize: 200,
transport: {
read: {
type:
'post'
,
dataType:
'json'
,
url: url
}
},
schema: {
data:
'data'
,
total:
'total'
,
model: {
id:
'EmployeeId'
,
fields: {
Name: { type:
'string'
},
Email: { type:
'string'
},
EmployeeNumber: { type:
'number'
},
HireDate: { type:
'date'
},
Active: { type:
'boolean'
}
}
}
}
});
$(
'#grid'
).kendoGrid({
dataSource: dataSource,
height: 400,
columns: [
{ field:
'Name'
, title:
'Name'
},
{ field:
'Email'
},
{ field:
'EmployeeNumber'
, title:
'Emplyee #'
},
{ field:
'HireDate'
, title:
'Hire Date'
, template:
'#= kendo.toString(toDate(HireDate), "MM/dd/yyyy")#'
},
{ field:
'Active'
}
],
filterable:
true
,
sortable: {
mode:
'multiple'
},
scrollable: {
virtual:
true
}
});
});
</script>
router.navigate(
'/search + '
?q=
' + encodeURIComponent($('
#search-input').value()));
router.route(
'/search'
,
function
() {
applicationLayout.showIn(
'#search-view'
, searchView);
$(
'#search-results'
).html(
'<gcse:searchresults-only></gcse:searchresults-only>'
);
var
script = (document.location.protocol ===
'https:'
?
'https:'
:
'http:'
) +
'//www.google.com/cse/cse.js?cx=003237445845897440411%3Atuurehzakfu'
;
$.getScript(script);
});
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?