Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1845
Hierarchical Grid's child's datasourceurl isn't used
posted

I have a hierarchical grid where I've set the parent and child grid's datasourceurls per this example:

http://ko.infragistics.com/products/jquery/sample/hierarchical-grid/hierarchical-grid-load-on-demand

The grid initially loads properly, the parent data url is called.  However, when I click the plus sign, the parent's url is called again, not the child's.  Here's my code:

$('#CommissionRules_Grid').igHierarchicalGrid({
dataSource: '_CommissionRulesGrid',
autoGenerateColumns: false,
autoGenerateLayouts: false,
responseDataKey: 'Records',
generateCompactJSONResponse: false,
columns: [{
headerText: '<span style=\'text-align: left; display:block;\'>ID<span>',
key: 'Tcr_id',
width: '0',
hidden: true,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Tcr_id}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Active<span>',
key: 'Tcr_active',
width: '50px',
hidden: false,
dataType: 'bool',
template: '<span style="text-align: center; display:block;"><input class="gridBool" type="checkbox" {{if ${Tcr_active} === "true" }} checked="checked" {{/if}} </input></span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Rule Name<span>',
key: 'Tcr_rule_name',
width: '100px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Tcr_rule_name}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Status<span>',
key: 'Fk_status_code',
width: '50px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Fk_status_code}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Sales Type<span>',
key: 'Fk_tst_sale_type',
width: '75px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Fk_tst_sale_type}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Trans Type<span>',
key: 'Fk_com_trans_type',
width: '75px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Fk_com_trans_type}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Start Date<span>',
key: 'Tcr_eff_start_date',
width: '50px',
hidden: false,
dataType: 'date',
formatter: Orange.toDateString,
template: '<span style=\'text-align: center; display:block;\'>${Tcr_eff_start_date}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>End Date<span>',
key: 'Tcr_eff_end_date',
width: '50px',
hidden: false,
dataType: 'date',
formatter: Orange.toDateString,
template: '<span style=\'text-align: center; display:block;\'>${Tcr_eff_end_date}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Reserve Flag<span>',
key: 'Tcr_chk_reserve_flag',
width: '50px',
hidden: false,
dataType: 'bool',
template: '<span style="text-align: center; display:block;"><input class="gridBool" type="checkbox" {{if ${Tcr_chk_reserve_flag} === "true" }} checked="checked" {{/if}} </input></span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Exec Flag<span>',
key: 'Tcr_inc_resort_exec_flag',
width: '50px',
hidden: false,
dataType: 'bool',
template: '<span style="text-align: center; display:block;"><input class="gridBool" type="checkbox" {{if ${Tcr_inc_resort_exec_flag} === "true" }} checked="checked" {{/if}} </input></span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Sales Center<span>',
key: 'SalesCtr',
width: '100px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${SalesCtr}</span>'
}],
columnLayouts: [{
dataSource: '/TASCommissions/CommissionRules/_EmployeesGrid',
autoGenerateColumns: false,
autoGenerateLayouts: false,
responseDataKey: 'Records',
generateCompactJSONResponse: false,
columns: [{
headerText: '<span style=\'text-align: left; display:block;\'>Employee_FK<span>',
key: 'fk_tcr_id',
width: '0',
hidden: true,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${fk_tcr_id}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Resort<span>',
key: 'Resort_name',
width: '100px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Resort_name}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Role<span>',
key: 'Fk_tsr_role_name',
width: '75px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Fk_tsr_role_name}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Total Charges<span>',
key: 'Total_Charges',
width: '100px',
hidden: false,
dataType: 'number',
formatter: Orange.toCurrencyString2,
template: '<span style=\'text-align: right; padding-right:20px; display:block;\'>${Total_Charges}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Last Name<span>',
key: 'Emp_last_name',
width: '75px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Emp_last_name}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>First Name<span>',
key: 'Emp_first_name',
width: '75px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Emp_first_name}</span>'
}, {
headerText: '<span style=\'text-align: left; display:block;\'>Pay On<span>',
key: 'Fk_tcrf_field_name',
width: '100px',
hidden: false,
dataType: 'string',
formatter: null,
template: '<span style=\'text-align: left; display:block;\'>${Fk_tcrf_field_name}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Rate %<span>',
key: 'Tcer_rate',
width: '50px',
hidden: false,
dataType: 'number',
formatter: Orange.toDecimalString0,
template: '<span style=\'text-align: right; padding-right:20px; display:block;\'>${Tcer_rate}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Value<span>',
key: 'Tcer_value_per_deal',
width: '50px',
hidden: false,
dataType: 'number',
formatter: Orange.toDecimalString0,
template: '<span style=\'text-align: right; padding-right:20px; display:block;\'>${Tcer_value_per_deal}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>Start Date<span>',
key: 'Tcer_eff_start_date',
width: '50px',
hidden: false,
dataType: 'date',
formatter: Orange.toDateString,
template: '<span style=\'text-align: center; display:block;\'>${Tcer_eff_start_date}</span>'
}, {
headerText: '<span style=\'text-align: center; display:block;\'>End Date<span>',
key: 'Tcer_eff_end_date',
width: '50px',
hidden: false,
dataType: 'date',
formatter: Orange.toDateString,
template: '<span style=\'text-align: center; display:block;\'>${Tcer_eff_end_date}</span>'
}]
}],
features: [{
sortUrlKey: 'sort',
sortUrlKeyAscValue: 'asc',
sortUrlKeyDescValue: 'desc',
name: 'Sorting',
mode: 'single',
type: 'local'
}, {
name: 'Selection',
mode: 'row',
multipleSelection: false
}, {
name: 'Resizing'
}],
jQueryTemplating: false,
autoAdjustHeight: false,
width: '100%',
renderCheckboxes: true,
primaryKey: 'Tcr_id',
initialDataBindDepth: 0,
localSchemaTransform: false
});
});

  • 29417
    Suggested Answer
    Offline posted

    Hello JoshNoe

    Thank you for posting in our forum. 

    It seems you’ve missed enabling the following property:

    odata: true

    I don’t seem to find that setting in the code you’ve pasted.

    If you set it to true it will encode all requests using OData conventions and the $expand syntax which will allow you to load the data from your service on demand.

     

    Let me know if that helps.

     

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://ko.infragistics.com/support