Using my custom ajax call for load on demand on igHierarchical Grid

元气小坏坏 提交于 2019-12-20 04:57:30

问题


I am trying to implement the igHierarchicalGrid for my application, which can have multiple levels depending on user requirement. I need to use Load on Demand feature without oData, so that I can use server's JSON response, parse it and show the results in child grid.

Issues, I am facing is How to use my custom ajax call from which i can send some data to server not necessary the primary key and gets the result in desired format so that the child grid corresponding to that grid is loaded.

I could not find an example for Load on Demand without OData in Jquery.

I tried to give following settings:

// The topmost level

var hierarchicalGridConfigs={
        width: "100%",
        initialDataBindDepth: 0,
        dataSourceType: "json",
        dataSource: jsonData,
        oData:false,
        rest:false,
        autoGenerateLayouts: false,
        primaryKey:"id",
        columns:getDefaultColumns(),
        autoGenerateLayouts: false,
        columnLayouts: getColumnLayouts(0,configs,levels-1)
    };

For child levels:

function getColumnLayouts(i,configs,levels){
    var layouts=[];
    var layout1={};
    /*layout1["name"]="childReports";*/
    /*layout1["dataSourceType"]= "json";*/
    layout1["dataSource"]="myURL";
    layout1["type"]="remoteUrl";
    layout1["autoGenerateColumns"]= false;
    layout1["odata"]= false;
    layout1["rest"]= false;
    layout1["primaryKey"]="id";
    layout1["columns"]=configs[i];
    if(i<levels){
        layout1["columnLayouts"]=getColumnLayouts(++i,configs,levels);
    }  
    layouts.push(layout1);
    return layouts;
}

But, for child columns, its taking the URL, directly as String which it assumed to be JSON.

How can i make my custom Ajax Call, and how can I pass parameters from parent row in that request.

来源:https://stackoverflow.com/questions/28434621/using-my-custom-ajax-call-for-load-on-demand-on-ighierarchical-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!