Does the following function make sense to you?? Where you currently pass the SOURCE OBJECT array into the New SlickGrid you instead create a NEW GRID_SOURCE - then call the SET_SOURCE method to pass in the SOURCE OBJECT array. Then in that spot where you pass the SOURCE OBJECT you instead pass the GET_OUTPUT method.
var grid_source = function () {
var origSource = [];
var expandedRows = [];
var outputRows = [];
var i_set_output = function() {
for (var i=0; i < origSource.length; i++) {
outputRows.push(origSource[i]);
if (expandedRows[i]) {
for (var j=0; j < origSource[i].ChildField.length; j++) {
outputRows.push(origSource[i].ChildField[j]);
}
}
}
};
return {
set_source: function (a) {
origSource = a;
for (var i=0; i < origSource.length; i++) {
expandedRows[i] = false;
}
i_set_output();
},
get_output: function () {
return outputRows;
},
expand_row: function (i) {
expandedRows[i] = true;
close_row: function (i) {
expandedRows[i] = false;
i_set_output();
}
|;
};