1
0
Fork 0
forked from 0x2620/oxjs

Ox.getPositionById() -> Ox.getIndexById()

This commit is contained in:
rolux 2012-01-04 13:41:05 +05:30
commit 8097cc7812
19 changed files with 23 additions and 30 deletions

View file

@ -82,7 +82,7 @@ Ox.ArrayEditable = function(options, self) {
}
function getSelectedPosition() {
return Ox.getPositionById(self.options.items, self.options.selected);
return Ox.getIndexById(self.options.items, self.options.selected);
}
function renderItems() {

View file

@ -74,7 +74,7 @@ Ox.Button = function(options, self) {
title: value.title || value
};
});
self.value = Ox.getPositionById(self.options.values, self.options.value);
self.value = Ox.getIndexById(self.options.values, self.options.value);
if (self.value == -1) {
self.value = 0;
self.options.value = self.options.values[0].id;
@ -144,8 +144,7 @@ Ox.Button = function(options, self) {
that.toggle = function() {
if (self.options.values.length) {
self.value = 1 - Ox.getPositionById(self.options.values, self.options.value);
Ox.print('S:O:', self.options, self.value)
self.value = 1 - Ox.getIndexById(self.options.values, self.options.value);
self.options.title = self.options.values[self.value].title;
self.options.value = self.options.values[self.value].id;
setTitle();

View file

@ -338,7 +338,7 @@ Ox.Filter = function(options, self) {
Ox.Log('Form', 'old new', oldConditionType, newConditionType)
condition.key = key;
if (changeConditionType || changeConditionFormat) {
if (Ox.getPositionById(self.conditionOperators[newConditionType], condition.operator) == -1) {
if (Ox.getIndexById(self.conditionOperators[newConditionType], condition.operator) == -1) {
condition.operator = self.conditionOperators[newConditionType][0].id;
}
if (

View file

@ -164,7 +164,6 @@ Ox.Form = function(options, self) {
var values = {};
if (arguments.length == 0) {
self.$items.forEach(function($item, i) {
//Ox.print('??????-??', self.itemIds[i], self.$items[i].value(), Ox.typeOf(self.$items[i].value()))
values[self.itemIds[i]] = self.$items[i].value();
});
//Ox.Log('Form', 'VALUES', values)

View file

@ -115,7 +115,7 @@ Ox.FormPanel = function(options, self) {
});
self.$forms.forEach(function($form, i) {
Ox.print(self.sections[i], 'valid', $form.valid());
//Ox.print(self.sections[i], 'valid', $form.valid());
self.$list.value(self.sections[i], 'valid', $form.valid());
});

View file

@ -28,7 +28,6 @@ Ox.ObjectArrayInput = function(options, self) {
setValue(self.options.value);
function addInput(index, value) {
Ox.print('ADD INPUT', index, value)
self.$element.splice(index, 0, Ox.Element()
.css({
width: self.options.width + 'px',

View file

@ -81,7 +81,6 @@ Ox.SelectInput = function(options, self) {
}
function setValue(isOther) {
Ox.print('SET VALUE', isOther)
if (
(!self.options.value && isOther !== true)
|| Ox.map(self.options.items, function(item) {
@ -120,7 +119,6 @@ Ox.SelectInput = function(options, self) {
return getValue();
} else {
self.options.value = arguments[0];
Ox.print('SOV:::', self.options.value)
setValue();
return that;
}