hi,
i have an cobobox. i want igHierarchicalGrid changed when i change combobox then the grid change
please help me how can i do it!
please give me a sample
thanks you very much!
Hello Cuong,
Thank you for contacting Infragistics Developer Support!
You can change the grid dataSource using the combo event selectionChanged. You can set the new dataSource of the grid by using the dataSource property setter and calling dataBind to apply changes.
$("#combo").igCombo({ dataSource: [ {'dataSourceId': 'dataSource1' }, {'dataSourceId': 'dataSource2' }, {'dataSourceId': 'dataSource3' }, {'dataSourceId': 'dataSource4' }, {'dataSourceId': 'dataSource5' } ], textKey: 'dataSourceId', valueKey: 'dataSourceId', width: '200px', selectionChanged: function(evt, ui) { var selection = ui.items[0]; switch (selection) { case 'dataSource1': $('#hierarchicalGrid').igGrid('options','dataSource', dataSource1); break; /* . . . */ default: break; } $('#hierarchicalGrid').igGrid('dataBind'); } });
Do not hesitate to contact me if you have additional questions.
thanks you for suported!
- can i use asp.net helper same abow sample
- and another question
i have and combobox and i gridview
when i change the combo box then the gridview not change, i used ajax
if i remove atributte "initialDataBindDepth: 1" it working fine
- and one more question: the child object is nothing but the grid still general row, how can i fix it? i used json object
here is my code
Action()
Function GetReportTemplate(id As String) As JsonResult If String.IsNullOrWhiteSpace(id) Then Return Json(New With {.Status = "Err"}) End If Dim result = GetReport(id, 0) Return Json(New With {.Status = "OK", .ReportTemplate = result}) End Function
View()
function PopulateReportTemplateGrid(reportBatchID) { var url = '@Url.Action("GetReportTemplate", "Report")' + "/" + reportBatchID; //var postdata = { dteTradeDate: $('#TradeDate').igEditor('value'), dteSettlement: $('#SettlementDate').igEditor('value'), dblParValue: $('#ParValue').igEditor('value') //}; //data: JSON.stringify(postdata), $.ajax({ url: url, type: 'POST', dataType: 'json', contentType: 'application/json; charset=utf-8', success: function (data) { if (data.Status == "OK") { var reportTemplate = data.ReportTemplate; $("#grdReportTemplate").igHierarchicalGrid({ //initialDataBindDepth: 1, dataSource: reportTemplate, //dataSourceType: "json", //responseDataKey: "d", autoGenerateColumns: false, primaryKey: "RecordID", width: "100%", height: "500px", renderCheckboxes: true, columns: [ { headerText: "RecordID", key: "RecordID", width: "50px", dataType: "number", hidden: true }, { headerText: "ReportID", key: "ReportID", width: "130px", dataType: "number", hidden: true }, { headerText: "ParentReportID", key: "ParentReportID", width: "50px", dataType: "number", hidden: true }, { headerText: "Select", key: "IsChecked", width: "80px", dataType: "bool" }, { headerText: "ReportDsc", key: "ReportDsc", width: "130px", dataType: "string" }, { headerText: "ReportFileName", key: "ReportFileName", width: "50px", dataType: "string", hidden: true }, ], autoGenerateLayouts: false, defaultChildrenDataProperty: "lsReportTemplate", columnLayouts: [ { name: "lsReportTemplate", //responseDataKey: "", childrenDataProperty: "lsReportTemplate", //autoGenerateColumns: false, primaryKey: "ReportID", ForeignKey: "ParentReportID", renderCheckboxes: true, columns: [ { headerText: "RecordID", key: "RecordID", width: "50px", dataType: "number", hidden: true }, { headerText: "ReportID", key: "ReportID", width: "130px", dataType: "number", hidden: true }, { headerText: "ParentReportID", key: "ParentReportID", width: "50px", dataType: "number", hidden: true }, { headerText: "Select", key: "IsChecked", width: "80px", dataType: "bool" }, { headerText: "ReportDsc", key: "ReportDsc", width: "130px", dataType: "string" }, { headerText: "ReportFileName", key: "ReportFileName", width: "50px", dataType: "string", hidden: true }, ], features: [ { name: "Updating", enableAddRow: false, editMode: "row", enableDeleteRow: false, columnSettings: [ { columnKey: "IsChecked", editorOptions: { type: "bool", disabled: false } }, { columnKey: "ReportDsc", editorOptions: { type: "string", disabled: true } } ] }], } ], features: [ { name: "Updating", enableAddRow: false, editMode: "row", enableDeleteRow: false, columnSettings: [ { columnKey: "IsChecked", editorOptions: { type: "bool", disabled: false } }, { columnKey: "ReportDsc", editorOptions: { type: "string", disabled: true } } ] }], }); } else { // } } }); }
Hello,
I am just following up to see if you need any further assistance with this issue. If so please let me know.