Hi,
I have a hierarchical grid that I am binding using knockout. The datasource I am using is made up of nested ViewModel objects, child tables represented as lists withing the parent record. I think I may be doing something incorrectly when binding the child tables and setting up the parent-child relationship. This seems to work file between the root level and the first level of children but from the second level on there seems to be issues. Included below is the table and view model source.
The specific error I'm getting is "Uncaught TypeError: Cannot set property 'SubMatrixId' of null".
The View Model objects are being created as:
MatrixRecord(RootLevel)
SubMatrixRecord(Level 1)
PlanningItemRecord(Level 2)
Table Definition
--------------------------------------------------------------------
<table id="gridMatrix" data-bind="
igHierarchicalGrid: {
dataSource: matrixData,
primaryKey: 'MatrixId',
loadOnDemand: false,
width: 'auto',
autoGenerateColumns: false,
columns: [
{ key: 'MatrixId', headerText: 'Id', dataType: 'number' },
{ key: 'MatrixDesc', headerText: 'Description', dataType: 'string' }
],
features: [
{
name: 'Selection',
},
name: 'Paging',
type: 'local',
pageSize: 5,
name: 'Updating',
editMode: 'none'
}
columnLayouts: [
key: 'SubMatrices',
primaryKey: 'SubMatrixId',
foreignKey: 'MatrixId',
autoGenerateLayouts: false,
{ key: 'SubMatrixId', headerText: 'Id', dataType: 'number' },
{ key: 'SubMatrixDesc', headerText: 'Description', dataType: 'string' },
{ key: 'MatrixId', headerText: 'Matrix Id', dataType: 'number' }
key: 'Items',
primaryKey: 'ItemId',
foreignKey: 'SubMatrixId',
{ key: 'ItemId', headerText: 'Id', dataType: 'number' },
{ key: 'ItemDesc', headerText: 'Description', dataType: 'string' },
{ key: 'SubMatrixId', headerText: 'Sub Matrix Id', dataType: 'number' }
{ name: 'Selection'},
]
}">
View Model Definitions
function MatrixRecord(matrixId, matrixDesc, subMatrices) {
///<summary>
/// Represents a single root level
/// record entry in the matrix grid.
///</summary>
return {
MatrixId: ko.observable(matrixId),
MatrixDesc: ko.observable(matrixDesc),
SubMatrices: ko.observableArray(subMatrices)
};
function SubMatrixRecord(subMatrixId, subMatrixDesc, parentMatrixId, items) {
/// record entry in the Sub-Matrix grid. Also
/// represents a child level entry of the Matrix grid.
SubMatrixId: ko.observable(subMatrixId),
SubMatrixDesc: ko.observable(subMatrixDesc),
MatrixId: ko.observable(parentMatrixId),
Items: ko.observableArray(items)
function PlanningItemRecord(itemId, itemDesc, subMatrixId,
availableQty, sellingPrice, rotationCd, falloutPct,
ftcRegulatedInd, frozenInd) {
/// Represents a child level entry to the sub-matrix
/// record entry in both the Matrix and Sub-Matrix grids.
ItemId: ko.observable(itemId),
ItemDesc: ko.observable(itemDesc),
AvailableQty: ko.observable(availableQty),
SellingPrice: ko.observable(sellingPrice),
RotationCd: ko.observable(rotationCd),
FalloutPct: ko.observable(falloutPct),
FtcRegulatedInd: ko.observable(ftcRegulatedInd),
FrozenInd: ko.observable(frozenInd)
var MatrixViewModel = function() {
var self = this;
self.matrixData = ko.observableArray([]);
Thanks,
Chris.
Hello HSN Development,
I hope this message finds you well.
Please let me know the jQuery scripts you are using, as currently, IgniteUI 2012 supports 1.7 and 1.8 at the latest.
If you have any questions, please let me know as well.
jquery-1.7.2.min.js
jquery.layout-latest.min.js
Thank you for the information.
We are keeping this in mind with our sample. I will update you by Monday of my findings.
At the moment, the sample is being tested using the current version we have.
I will keep you posted of our findings
We are almost done with our invetigation. I will have more details by Monday.
The sample testing is done. I will be attaching it by Monday.
Thank you for your patience while I am working ono this issue. At the moment, I am testing the sample using our current and upcoming version.
I will keep you posted shortly