PDA

View Full Version : [CLOSED] MultiCombo with SelectionMode=all not allowing uncheck



RCM
Dec 14, 2013, 6:15 PM
<body>
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:Panel runat="server">
<Items>
<ext:MultiCombo ID="MultiCombo1" runat="server" SelectionMode="All" Width="260">
<Items>
<ext:ListItem Text="Item 1" Value="1" />
<ext:ListItem Text="Item 2" Value="2" />
<ext:ListItem Text="Item 3" Value="3" />
<ext:ListItem Text="Item 4" Value="4" />
<ext:ListItem Text="Item 5" Value="5" />
</Items>

<SelectedItems>
<ext:ListItem Value="2" />
<ext:ListItem Index="4" />
</SelectedItems>
</ext:MultiCombo>
</Items>
</ext:Panel>

</form>
</body>


When I use the above code and try to uncheck a row it looses its highlight but the checkbox does not become unchecked

Vladimir
Dec 14, 2013, 6:41 PM
I cannot reproduce it with latest code, try to update from SVN and retest

RCM
Dec 14, 2013, 7:00 PM
Hi I am using Release version 2.2 and I am 2 weeks from release. So I cannot change my version

Baidaly
Dec 14, 2013, 11:27 PM
Hello!

Try to apply the following overriding:


<script>
Ext.override(Ext.net.MultiCombo, {
getPicker: function () {
if (!this.picker) {
this.listConfig = this.listConfig || {};

if (!this.listConfig.getInnerTpl) {
this.listConfig.getInnerTpl = function (displayField) {
return '<div class="x-combo-list-item {[this.getItemClass(values)]}">' +
'<div class="x-mcombo-text">{' + displayField + '}</div></div>';
};
}

this.listConfig.selModel = {
mode: 'SIMPLE'
};

this.picker = this.createPicker();

this.mon(this.picker.getSelectionModel(), 'select', this.onListSelect, this);
this.mon(this.picker.getSelectionModel(), 'deselect', this.onListDeselect, this);

this.picker.tpl.getItemClass = Ext.Function.bind(function (values) {
var record,
//fieldValue = this.getValue(),
searchValue,
selected;

if (this.selectionMode === "selection") {
return "";
}

Ext.each(this.store.getRange(), function (r) {
// do not replace == by ===
if (r.get(this.valueField) == values[this.valueField]) {
record = r;
return false;
}
}, this);

selected = record ? this.picker.getSelectionModel().isSelected(record) : false;

/*if (record && !selected && !this.picker.viewReady) {
searchValue = record.get(this.valueField);
Ext.each(fieldValue, function (v){
if (searchValue == v) {
selected = true;
return false;
}
});
}*/

if (selected) {
return "x-mcombo-item-checked";
}

return "x-mcombo-item-unchecked";

}, this, [], true);


if (this.selectionMode !== "checkbox") {
this.picker.on("render", function () {
this.picker.overItemCls = "x-multi-selected";
}, this);
}

this.picker.on("viewready", this.onViewReady, this, { single: true });
}

return this.picker;
},

onListSelect: function (model, record) {
if (!this.ignoreSelection) {
this.selectRecord(record);
}
},

onListDeselect: function (model, record) {
if (!this.ignoreSelection) {
this.deselectRecord(record);
}
}
});
</script>