I am loading a complex JSON object via AngularJS. The object contains several child collections that I want to display in Kendo UI grids. When I first load the page, the object doesn't exist at all. Periodically, the user can use a master list (not included here) to change the entire JSON object.
So far, I have the object loading correctly and displaying/working with AngularJS integration for the basic fields. The grid in question is configured to appear inside a Kendo TabStrip, as part of an AngularJS directive that displays my entire child form.
I currently define the grid (and tabStrip) in the Angular HTML template for the directive as:
<
div
class
=
"detailTabStrip"
kendo-tab-strip
k-content-urls
=
"[ null, null]"
>
<!-- tab list -->
<
ul
>
<
li
class
=
"k-state-active"
>Facility Types</
li
>
<
li
>Notes</
li
>
</
ul
>
<
div
style
=
"padding: 1em"
>
<
kendo-grid
k-options
=
"typeSnapshotGridOptions"
k-scope-field
=
"typeSnapshotGrid"
style
=
"height:99%;width:100%"
>
</
kendo-grid
>
</
div
>
<
div
style
=
"padding: 1em"
>
TBD
</
div
>
</
div
>
My controller supplies the grid options:
$scope.typeSnapshotGridOptions = {
dataSource: {
data: [],
pageSize: 5,
},
sortable: true,
groupable: false,
resizable: true,
useStaticHeaders: true,
allowScroll: true,
selectable: "row",
pageable: {
refresh: false,
pageSizes: false,
buttonCount: 5
},
autoSync: true,
//dataBound: function () {
// this.expandRow(this.tbody.find("tr.k-master-row").first());
//},
columns: [(...omitted for brevity...)]
};
And, when the JSON object is changed, it reinitializes the grid:
$scope.$on('facilitySelected', function (ev, args) {
kendo.ui.progress($('#facilityDetailSection'), true);
$http.get('/FacAdmin/GetFacilityDetail/' + args.facilityID)
.then(function (response) {
$scope.facility = response.data;
$scope.typeSnapshotGrid.dataSource.data($scope.facility.TypeSnapshots);
kendo.ui.progress($('#facilityDetailSection'), false);
});
});
As far as displaying data goes, this all works. The grid starts off invisible (because I have an ng-show vanishing the entire pane if there is no data), and it appears and shows the correct child rows each time I load a new complex JSON object.
However, the appearance is horrible. The grid appears about 100px tall (despite settings for 100% height and width, and use of useStaticHeaders and allowScroll) the very first time I load a JSON collection into it. On the second and subsequent loads, the grid appears the correct size and is almost right... the last row is missing the bottom border.
I have tried:
- * refresh()
- * dataSource.sync()
- * dataSource.read()
- * replacing the datasource instead of replacing the just the data
None of these had the slightest effect.
I am testing in Chrome and Chrome's debugger reports no JS errors. My Telerik version was installed from telerik.kendoui.professional.2016.2.714.commercial, which I assume also represents the version number.
Attached: Screenshot of grid appearance on first load of the child collection (_1) and on subsequent loads (_2).
Please suggest additional possible fixes.