af:selectManyChoose使用的获取值问题
2014-03-17 12:23
441 查看
组件绑定VO代码如下:
在实际开发中,获取下拉值出现的最多的二种问题是:1拿到的索引;2拿到选中值的前一条记录:
参考代码:
<af:selectManyChoice value="#{bindings.allDepartments.inputValue}" label="#{bindings.allDepartments.label}" id="smc1"> <f:selectItems value="#{bindings.allDepartments.items}" id="si1"/> </af:selectManyChoice>
在实际开发中,获取下拉值出现的最多的二种问题是:1拿到的索引;2拿到选中值的前一条记录:
参考代码:
public String cb1_action() { BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getCurrentBindingsEntry(); JUCtrlListBinding allDepartsmentList = (JUCtrlListBinding) bindings.get("allDepartments"); Object[] selVals = allDepartsmentList.getSelectedValues(); for (int i = 0; i < selVals.length; i++) { Integer val = (Integer)selVals[i]; //... } return null; }
public String cb1_action() { BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getCurrentBindingsEntry(); JUCtrlListBinding allDepartsmentList = (JUCtrlListBinding) bindings.get("allDepartments"); int[] selVals = allDepartsmentList.getSelectedIndices(); for (int indx : selVals ) { Row rw = allDepartsmentList.getRowAtRangeIndex(indx); //... do your stuff } return null; }
/** * * @param attrName * @param ind 选择的下拉索引值 * @param retrunStr 返回的属性字段名称 * @return */ public static Object getSelectListValue(String attrName,Object ind,String retrunStr){ BindingContext bctx = BindingContext.getCurrent(); BindingContainer bindings = bctx.getCurrentBindingsEntry(); JUCtrlListBinding listBinding = (JUCtrlListBinding) bindings.get(attrName); listBinding.setSelectedIndex(Integer.parseInt(ind.toString())); Row selectedValue = (Row) listBinding.getSelectedValue(); return selectedValue.getAttribute(retrunStr); }
相关文章推荐
- Oracle ADF af:selectManyShuttle的使用
- 如何使用af:selectManyChoice组件
- Android 使用url获取数据时的文字编码问题
- Qt在线程中使用QAxObject,获取对象为空问题
- select2在bootstrap modal中不能正常使用问题
- AHK 语句 FileSelectFile 使用选项“S16”时需注意的问题
- Spring 创建对象的问题,不同构造方法创建对象,使用工厂类类获取对象、单例或多例、延迟创建问题
- ALAssetsLibrary的使用问题:获取到ALAsset的thumbnail或者其他属性保存数组,在别地地方为nil的问题处理
- ObjectARX中使用非模式对话框进行数据库操作时获取空指针问题
- 使用Nginx代理,HttpContext.Current.Request.Url.Host.ToString()获取地址是原地址的问题。
- .net core中使用Type.GetType()从字符串获取类型遇到的问题
- mysql中insert与select的嵌套使用解决组合字段插入问题
- 关于使用request[this.控件名.Unique]获取控件值的问题
- WebLogic下使用URL.openConnection获取连接返回 HttpsURLConnection与SOAPHttpsURLConnection的问题
- J2EE 关于WebLogic下应用使用URL.openConnection获取连接返回 HttpsURLConnection与SOAPHttpsURLConnection的问题
- SqlServer中使用Select语句给变量赋值的时候需要注意的一个问题
- 解决绕过android下apk使用usb设备权限查询相应问题,自动获取usb权限
- PHP 使用 $_SERVER['PHP_SELF'] 获取当前页面地址及其安全性问题
- UsageStatsManager怎样使用问题详解和获取应用使用信息
- 使用GetDIBits获取图片数据时遇到的问题