mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-14 18:08:21 +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
|
||||
// Shmushed keys look like: ${row}[info_cat]
|
||||
// Expanded: ${row}: Object{info_cat: ..value}
|
||||
if (this.splitIds)
|
||||
{
|
||||
// For each index, we need a key: {..} sub array
|
||||
for(var key in _data) {
|
||||
// Split up indexes
|
||||
var indexes = key.split('[');
|
||||
if (indexes.length > 1)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
// Put data in the proper place
|
||||
if(indexes.length > 1)
|
||||
{
|
||||
var value = _data[key];
|
||||
var target = _data;
|
||||
for(var i = 0; i < indexes.length; i++) {
|
||||
indexes[i] = indexes[i].replace(']','');
|
||||
if(typeof target[indexes[i]] == "undefined") {
|
||||
target[indexes[i]] = i == indexes.length-1 ? value : {};
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ var et2_selectbox = et2_inputWidget.extend({
|
||||
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
|
||||
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
|
||||
var content_options = this.getArrayMgr("sel_options").getRoot().getEntry(name_parts[name_parts.length-1]);
|
||||
|
||||
// Try again according to ID
|
||||
if(!content_options) content_options = this.getArrayMgr("sel_options").getEntry(this.id);
|
||||
// Try again according to ID, but strip any encoded ][
|
||||
if(!content_options) content_options = this.getArrayMgr("sel_options").getEntry(this.id.replace(/[/g,'[').replace(/]/g,']'));
|
||||
if(_attrs["select_options"] && content_options)
|
||||
{
|
||||
_attrs["select_options"] = jQuery.extend({},_attrs["select_options"],content_options);
|
||||
|
Loading…
Reference in New Issue
Block a user