Hi All,I have an requirement that i need to load data on demand for igHierarchicalGrid. I am not able to give configuration of datasource using either ODATA or REST settings. What i need is, when user clicks on expand button, then there should be one request made to my server which returns data only for that subchild.
The major issue I am facing is not able to give datasource or dataUrl from which, data will be loaded on the fly. Whatever examples i am getting is for ASP.NET MVC, which is of no help to me. I tried setting the dataSource in ColumnLayout as path to my request, but I am getting error as: Uncaught TypeError: Cannot read property '__deferred' of undefinedAnd also, i will need that while querying server, how can I send data or parameters in the request, the parameter should be set from the entries of the parent row which is getting expanded, NOT NECESSARY THE PRIMARY KEYI tried the approach at http://ko.infragistics.com/community/forums/t/79652.aspx, but failedAny sort of help will be appreciatedRegards,
Got the point, ui.owner.options.requestType = "POST";
This option is not available in 2013.1 which i am using.
Hi,What I meant from my statement is, despite writing it to be a post request, it is sending GET request only. New URL is getting hit, but its still a GET request.ui.owner.options.requestType = "POST";And, what i need in second option is ability to move up in the hierarchy i.e. suppose 2 levsls are there. When i expand grid at 0th level, i got another hierarchical grid, when I expand any row of this grid, I should be able to pass data from parent as well as parent's parent.The auto generated URL pass all the data up to root grid by concatenating them, but it pass data only of ID. A workaround i am using is, creating the ID which contains data from more than one column which I required and keeping the column hidden in display. That's how, i am able to send the desired data to server.
Hello Vardhan, Vivek,
About point 1. What do you mean that the option is not there? I tested it in my sample and setting it this way works.
About point 2. You can take the parent row data with the following code:
$(document).on("iggriddatabinding", function (evt, ui) { if (!ui.owner.element.hasClass("ui-iggrid-root")) { var parentRowId = ui.owner.element.parents("tr[data-container='true']").prev().data("id"), parentGrid = ui.owner.element.parents("table.ui-iggrid-table").data("igGrid"), parentRowData = parentGrid.findRecordByKey(parentRowId); //modify your data source here ui.owner.options.requestType = "POST"; ui.owner.options.dataSource = "my data source"; } });
$(document).on("iggriddatabinding", function (evt, ui) {
if (!ui.owner.element.hasClass("ui-iggrid-root")) {
var parentRowId = ui.owner.element.parents("tr[data-container='true']").prev().data("id"),
parentGrid = ui.owner.element.parents("table.ui-iggrid-table").data("igGrid"),
parentRowData = parentGrid.findRecordByKey(parentRowId);
//modify your data source here
ui.owner.options.requestType = "POST";
ui.owner.options.dataSource = "my data source";
}
});
Hope this helps,Martin PavlovInfragistics, Inc.
Hi,I am trying what you said. A few issues:1) ui.owner.options.requestType = "POST"; option is not there2) I need to pass some parameters in the request, the parameters will be from parent row, how can i get those parameters??I am able to change the datasource URL as told by you, it is working,but still facing issue in parameters (from parent grid row) and changing to POST
Try with handling the igGrid.dataBinding event and in the event handler set the requestType and dataSource options.
Here is an example code:
$(document).on("iggriddatabinding", function (evt, ui) { //skip the event for the igHierarchicalGrid itself and only handle the child grids if (!ui.owner.element.hasClass("ui-iggrid-root")) { //modify your data source here ui.owner.options.requestType = "POST"; ui.owner.options.dataSource = "my data source"; } });
//skip the event for the igHierarchicalGrid itself and only handle the child grids