PDA

View Full Version : Dependency multiple selection combo box in Grid



ballu
Nov 22, 2016, 10:54 AM
I created grid with one combo box column. i need output like ---if I select first row combo box values the remaining grid rows combo box not have first row selected values.. same way all the rows combo boxes has different Values for different rows.
Ex:
Total combo box values are
var listdata = [{ Text: 'SampleA', Value: '11' },
{ Text: 'SampleB', Value: '12' },
{ Text: 'SampleC', Value: '13' },
{ Text: 'SampleD', Value: '14' },
{ Text: 'SampleE', Value: '15' },
{ Text: 'SampleF', Value: '16' },
{ Text: 'SampleG', Value: '17' },
{ Text: 'SampleH', Value: '18' }];

if i selected first row combo with 'SampleB','SampleC'
then remaining all row combo has all above values except 'SampleB','SampleC'

For this i taken combo box event as 'BeforeQuery'. It is working fine but combo box not expanded up to 3 times attempt... after that it is working fine...please suggest first attempt works ...
i tried with other events like render,expand,active....but no use

CSHTML Code:
X.ComponentColumn()
.Editor(true)
.ID("FileSelectionColumn")
.Text("File Mapping")
.Sortable(false)
.DataIndex("SelectedFileIds")
.MinWidth(150)
.Flex(2)
.Component(
X.MultiCombo().Delimiter(",")
.FieldLabel("")
.ValueField("Value")
.ForceSelection(false)
.EmptyText("Select --")
.DisplayField("Text")
.Listeners(li => { li.BeforeQuery.Fn = "OnFilesAccessMerge"; })
.Store(X
.Store()
.AutoLoad(false)
.Model(
X.Model()
.IDProperty("Value")
.Fields(
new ModelField("Value", ModelFieldType.String) { Mapping = "Value" },
new ModelField("Text", ModelFieldType.String) { Mapping = "Text" }
))
)
),

JS Code:

var listdata = [{ Text: 'SampleA', Value: '11' },
{ Text: 'SampleB', Value: '12' },
{ Text: 'SampleC', Value: '13' },
{ Text: 'SampleD', Value: '14' },
{ Text: 'SampleE', Value: '15' },
{ Text: 'SampleF', Value: '16' },
{ Text: 'SampleG', Value: '17' },
{ Text: 'SampleH', Value: '18' }];
var OnFilesAccessMerge = function (item) {
var currentSelectedComboValues = this.value;
if (item.combo.store != undefined) {
item.combo.store.loadData([], false);
if (App.ElectronicDeliverableListStore != undefined) {
var totalSelectedComboValues = [];
if (App.ElectronicDeliverableListStore.data.items != null && App.ElectronicDeliverableListStore.data.items.leng th > 0) {
$.each(App.ElectronicDeliverableListStore.data.ite ms, function (storeDataIndex, storeDataItem) {
if (storeDataItem.data.SelectedFileIds != null && storeDataItem.data.SelectedFileIds != "" && storeDataItem.data.SelectedFileIds.length > 0) {
$.each(storeDataItem.data.SelectedFileIds, function (arrindex, arrdata) {
if (currentSelectedComboValues.indexOf(arrdata) < 0) {
// item.combo.setValue(arrdata);
totalSelectedComboValues.push(arrdata);
}
});
}
});
if (totalSelectedComboValues.length > 0) {
$.each(listdata, function (listItemIndex, listItemData) {
if (totalSelectedComboValues.indexOf(listItemData.Val ue) < 0) {
item.combo.getStore().add(listItemData);
}
});
}
else {
$.each(listdata, function (listItemIndex, listItemData) {
item.combo.getStore().add(listItemData);
});

}
}
}
}
}

fabricio.murta
Nov 23, 2016, 4:55 PM
Hello @ballu! Welcome to Ext.NET Forums!

I believe you posted your question in the wrong forums section! You seem to have a question, and the section you created this topic is aimed for working examples and useful code.

You also should wrap your code in
blocks so they become formatted and readable.

There's also no clue on which version of Ext.NET you are using. Can you review your original post with this information and code blocks so we can move it to the correct section on the forums?

Please review our guidelines on posting new threads as they will provide you with very useful information on posting threads that helps us helping you!

1. More Information Required (http://forums.ext.net/showthread.php?10205-More-Information-Required)
2. Forum Guidelines (http://forums.ext.net/showthread.php?3440-Forum-Guidelines-For-Posting-New-Topics)

Hope to hear back from you soon!