Check array length too - if arrayMgr returns an empty array, keep looking for options

This commit is contained in:
Nathan Gray 2012-04-24 22:48:39 +00:00
parent f4871a7bee
commit 2ed29276f6

View File

@ -119,13 +119,13 @@ var et2_selectbox = et2_inputWidget.extend({
content_options = this.getArrayMgr("sel_options").getEntry(this.id); content_options = this.getArrayMgr("sel_options").getEntry(this.id);
// 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
if(!content_options) if(!content_options || content_options.length == 0)
{ {
content_options = this.getArrayMgr("sel_options").getRoot().getEntry(name_parts[name_parts.length-1]); content_options = this.getArrayMgr("sel_options").getRoot().getEntry(name_parts[name_parts.length-1]);
} }
// Maybe in a row, and options got stuck in ${row} instead of top level // Maybe in a row, and options got stuck in ${row} instead of top level
if(!content_options && this.getArrayMgr("sel_options").perspectiveData.row) if((!content_options || content_options.length == 0) && this.getArrayMgr("sel_options").perspectiveData.row)
{ {
var row_id = this.id.replace(/[0-9]+/,'${row}'); var row_id = this.id.replace(/[0-9]+/,'${row}');
content_options = this.getArrayMgr("sel_options").getEntry(row_id); content_options = this.getArrayMgr("sel_options").getEntry(row_id);