mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-15 02:19:39 +01:00
Get selectboxes inside datagrid working
This commit is contained in:
parent
5284844780
commit
6426b2d2db
@ -40,25 +40,22 @@ var et2_arrayMgr = Class.extend({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Expand sub-arrays that have been shmushed together, so further perspectives work
|
// Expand sub-arrays that have been shmushed together, so further perspectives work
|
||||||
|
// Shmushed keys look like: ${row}[info_cat]
|
||||||
|
// Expanded: ${row}: Object{info_cat: ..value}
|
||||||
if (this.splitIds)
|
if (this.splitIds)
|
||||||
{
|
{
|
||||||
|
// For each index, we need a key: {..} sub array
|
||||||
for(var key in _data) {
|
for(var key in _data) {
|
||||||
|
// Split up indexes
|
||||||
var indexes = key.split('[');
|
var indexes = key.split('[');
|
||||||
if (indexes.length > 1)
|
|
||||||
{
|
// Put data in the proper place
|
||||||
indexes = [indexes.shift(), indexes.join('[')];
|
|
||||||
indexes[1] = indexes[1].substring(0,indexes[1].length-6);
|
|
||||||
var children = indexes[1].split('[]');
|
|
||||||
if(children.length)
|
|
||||||
{
|
|
||||||
indexes = jQuery.merge([indexes[0]], children);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(indexes.length > 1)
|
if(indexes.length > 1)
|
||||||
{
|
{
|
||||||
var value = _data[key];
|
var value = _data[key];
|
||||||
var target = _data;
|
var target = _data;
|
||||||
for(var i = 0; i < indexes.length; i++) {
|
for(var i = 0; i < indexes.length; i++) {
|
||||||
|
indexes[i] = indexes[i].replace(']','');
|
||||||
if(typeof target[indexes[i]] == "undefined") {
|
if(typeof target[indexes[i]] == "undefined") {
|
||||||
target[indexes[i]] = i == indexes.length-1 ? value : {};
|
target[indexes[i]] = i == indexes.length-1 ? value : {};
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var name_parts = this.id.replace(/]/g,'').split('[');
|
var name_parts = this.id.replace(/[/g,'[').replace(/]|]/g,'').split('[');
|
||||||
|
|
||||||
// Try to find the options inside the "sel-options" array
|
// Try to find the options inside the "sel-options" array
|
||||||
if(this.getArrayMgr("sel_options"))
|
if(this.getArrayMgr("sel_options"))
|
||||||
@ -89,8 +89,8 @@ var et2_selectbox = et2_inputWidget.extend({
|
|||||||
// Select options tend to be defined once, at the top level, so try that first
|
// Select options tend to be defined once, at the top level, so try that first
|
||||||
var content_options = this.getArrayMgr("sel_options").getRoot().getEntry(name_parts[name_parts.length-1]);
|
var content_options = this.getArrayMgr("sel_options").getRoot().getEntry(name_parts[name_parts.length-1]);
|
||||||
|
|
||||||
// Try again according to ID
|
// Try again according to ID, but strip any encoded ][
|
||||||
if(!content_options) content_options = this.getArrayMgr("sel_options").getEntry(this.id);
|
if(!content_options) content_options = this.getArrayMgr("sel_options").getEntry(this.id.replace(/[/g,'[').replace(/]/g,']'));
|
||||||
if(_attrs["select_options"] && content_options)
|
if(_attrs["select_options"] && content_options)
|
||||||
{
|
{
|
||||||
_attrs["select_options"] = jQuery.extend({},_attrs["select_options"],content_options);
|
_attrs["select_options"] = jQuery.extend({},_attrs["select_options"],content_options);
|
||||||
|
Loading…
Reference in New Issue
Block a user