Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ext 4.2.0 compatibility #31

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/BoxSelect.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}
.x-boxselect ul.x-boxselect-list {
padding: 1px 3px;
margin: 0px;
}
ul.x-boxselect-list.x-boxselect-singleselect {
white-space: nowrap;
Expand All @@ -19,7 +20,7 @@ ul.x-boxselect-list.x-boxselect-singleselect {
}
.x-boxselect-input input, .x-boxselect-input div {
border: none;
background: none;
background-color: inherit;
line-height: 18px !important;
height: 20px;
width: 100%;
Expand Down
21 changes: 6 additions & 15 deletions src/BoxSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,30 +554,21 @@ Ext.define('Ext.ux.form.field.BoxSelect', {
* Used to determine if a record is filtered out of the current store's data set,
* for determining if a currently selected value should be retained.
*
* Slightly complicated logic. A record is considered filtered and should be retained if:
* A record is considered filtered and should be retained if:
*
* - It is not in the combo store and the store has no filter or it is in the filtered data set
* - It is not in the combo store and it is in the value store
* (Happens when our selected value is just part of a different load, page or query)
* - It is not in the combo store and forceSelection is false and it is in the value store
* (Happens when our selected value was created manually)
*
* @private
*/
isFilteredRecord: function(record) {
var me = this,
store = me.store,
valueField = me.valueField,
storeRecord,
filtered = false;
value = record.get(valueField);

storeRecord = store.findExact(valueField, record.get(valueField));

filtered = ((storeRecord === -1) && (!store.snapshot || (me.findRecord(valueField, record.get(valueField)) !== false)));

filtered = filtered || (!filtered && (storeRecord === -1) && (me.forceSelection !== true) &&
(me.valueStore.findExact(valueField, record.get(valueField)) >= 0));

return filtered;
return (me.store.findExact(valueField, value) === -1) &&
(me.valueStore.findExact(valueField, value) !== -1);
},

/**
Expand Down Expand Up @@ -1067,7 +1058,7 @@ Ext.define('Ext.ux.form.field.BoxSelect', {

me.multiSelectItemTpl = [
'<tpl for=".">',
'<li class="x-boxselect-item ',
'<li class="x-tab-default x-boxselect-item ',
'<tpl if="this.isSelected(values.'+ me.valueField + ')">',
' selected',
'</tpl>',
Expand Down