We getting record, returned optionDatasource, when using combobox in dynamicForm by FormItem.getSelectedRecord(). We want to use same function, when using combobox in ListGrid. Because We already getting detail information by optionDatasource from server. So we don't need to go to server second time.
This example demonstrates, usage of FormItem.getSelectedRecord() in dynamicForm. We want to similar usage in ListGrid.
This example demonstrates, usage of FormItem.getSelectedRecord() in dynamicForm. We want to similar usage in ListGrid.
Code:
//Creating dataSource function createDataSource(operationBindings, fields) { return isc.RestDataSource.create({ dataFormat: "json", operationBindings: operationBindings, jsonPrefix: "//'\"]]>>isc_JSONResponseStart>>", jsonSuffix: '//isc_JSONResponseEnd', fields: fields }); } //Summary optionDataSource var dsSummaryMuhasebeRecords = createDataSource( [ { operationType: "fetch", dataProtocol: "postMessage", dataURL: "../Muhasebe/GetSummaryMuhasebeHareketleri?SirketKodu=" + parameters.sirketKodu.toString() } ], [ { name: "KayitKoduId", type: "number", visibility: false }, { name: "KayitKodu", title: "Kayıt Kodu", type: "text" }, { name: "FisTarihi", title: "Fiş Tarihi", type: "date" }, { name: "FisNumarasi", title: "Fiş Numarası", type: "integer" }, ] ); var frmFisMasterBilgileri = isc.DynamicForm.create({ autoDraw: false, width: "100%", height: "50", numCols: 6, colWidths: [100, 100, 100, 100, 100, 100], isGroup: true, groupTitle: "Muhasebe Master Bilgileri", showResizeBar: true, fields: [ { name: "KayitKoduId", title: "Kayıt Kodu", editorType: "ComboBoxItem", optionDataSource: dsKayitKodlari, wrapTitle: false, displayField: "KayitAdi", valueField: "Id", pickListWidth: 300, pickListFields: [ { name: "KayitKodu" }, { name: "KayitAdi" } ], pickListProperties: { showFilterEditor: true }, click: function (form, item) { form.setValue("FisNumarasi", ""); } }, { name: "FisTarihi", title: "Fiş Tarihi", editorType: "DateItem", click: function (form, item) { form.setValue("FisNumarasi", ""); } }, { name: "FisNumarasi", title: "Fiş Numarası", type: "integer", editorType: "ComboBoxItem", optionDataSource: dsSummaryMuhasebeRecords, wrapTitle: false, displayField: "FisNumarasi", valueField: "FisNumarasi", pickListWidth: 300, pickListProperties: { showFilterEditor: true }, pickListFields: [ { name: "KayitKodu" }, { name: "FisTarihi" }, { name: "FisNumarasi" } ], //****************** EXAMPLE USAGE ******************************** changed: function (form, item, value) { //getting selectedRecord from optionDatasource var selectedRecord = item.getSelectedRecord(); //set value in form, selectedRecord.KayitKoduId form.setValue("KayitKoduId", selectedRecord.KayitKoduId); //set value in form, selectedRecord.FisTarihi form.setValue("FisTarihi", selectedRecord.FisTarihi); } //****************** EXAMPLE USAGE ******************************** } ] });
Comment