forked from 0x2620/oxjs
fix alphabetical order of annotations with tags, fixes #681
This commit is contained in:
parent
c4de1a3a40
commit
bc3fedb125
4 changed files with 30 additions and 17 deletions
|
|
@ -11,6 +11,7 @@ Ox.ArrayEditable = function(options, self) {
|
|||
.defaults({
|
||||
clickLink: null,
|
||||
editable: true,
|
||||
getSortValue: null,
|
||||
highlight: '',
|
||||
itemName: 'item',
|
||||
items: [],
|
||||
|
|
@ -208,7 +209,6 @@ Ox.ArrayEditable = function(options, self) {
|
|||
self.editing = false;
|
||||
that.blurItem();
|
||||
}
|
||||
Ox.print('SELECT ITEM', self.options.selected, self.selected);
|
||||
that.find('.OxSelected').removeClass('OxSelected');
|
||||
self.selected > -1 && self.$items[self.selected].addClass('OxSelected');
|
||||
triggerSelectEvent();
|
||||
|
|
@ -279,7 +279,13 @@ Ox.ArrayEditable = function(options, self) {
|
|||
|
||||
function sortItems() {
|
||||
if (!Ox.isEmpty(self.options.sort)) {
|
||||
self.options.items = Ox.sortBy(self.options.items, self.options.sort);
|
||||
self.options.items = Ox.sortBy(
|
||||
self.options.items,
|
||||
self.options.sort,
|
||||
self.options.getSortValue
|
||||
? {value: self.options.getSortValue}
|
||||
: {}
|
||||
);
|
||||
self.selected = getSelectedPosition();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -600,7 +600,6 @@ Ox.Menu = function(options, self) {
|
|||
if (ids.length == 1) {
|
||||
item = that.getItem(id);
|
||||
group = item.options('group');
|
||||
Ox.Log('Menu', 'checkItem', id, item, that.submenus)
|
||||
if (group) {
|
||||
offset = self.optionGroupOffset[group];
|
||||
position = getItemPositionById(id);
|
||||
|
|
|
|||
|
|
@ -199,6 +199,11 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
self.$annotations = Ox.ArrayEditable({
|
||||
clickLink: self.options.clickLink,
|
||||
editable: self.options.editable,
|
||||
getSortValue: self.options.type == 'text'
|
||||
? function(value) {
|
||||
return Ox.stripTags(value);
|
||||
}
|
||||
: null,
|
||||
highlight: self.options.highlight,
|
||||
items: self.annotations,
|
||||
placeholder: 'No ' + self.options.title,
|
||||
|
|
@ -540,7 +545,6 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
if (value === '') {
|
||||
self.editing = false;
|
||||
}
|
||||
value && Ox.print('----------------- select item in folder', value, self.options.collapsed)
|
||||
if (value && self.options.collapsed) {
|
||||
self.$panel.options({animate: false});
|
||||
self.$panel.options({collapsed: false});
|
||||
|
|
@ -620,7 +624,6 @@ Ox.AnnotationFolder = function(options, self) {
|
|||
};
|
||||
|
||||
that.updateItem = function(id, data) {
|
||||
Ox.print('-- UPDATE ITEM', id, data);
|
||||
var item = Ox.getObjectById(self.options.items, id);
|
||||
Ox.forEach(data, function(value, key) {
|
||||
item[key] = value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue