EasyUI 学习笔记(一)

来源:互联网 发布:搞笑淘宝店名 编辑:程序博客网 时间:2024/06/05 22:59

EasyUI是一个强大的,优雅的学习框架


其中,Combo Box (组合框)控件很简单,可以节省空间。从用户角度来看,这个控件是由一个文本输入控件和一个下拉菜单组成的。用户可以从一个预先定义的列表里选择一个选项,同时也可以直接在文本框里面输入文本。
1、定义控件对应变量
假定已经创建了一个Dialog,并且从控件工具箱将 Combo Box 控件拖放到上面。打开 Class Wizard,添加控件对应变量,
如:CComboBox m_cbExamble;
在后面的代码中会不断使用这个变量。
2、向控件添加 Items
1) 在Combo Box控件属性的Data标签里面添加,一行表示Combo Box下拉列表中的一行。换行用ctrl+回车。
2)利用函数 AddString()向Combo Box 控件添加 Items,如:
m_cbExample.AddString(“StringData1”);
m_cbExample.AddString(“StringData2”);
m_cbExample.AddString(“StringData3”);
3)也可以调用函数 InsertString()将 Item插入指定位置 nIndex,如:
m_cbExample.InsertString( nIndex, “StringData” );
3、从控件得到选定的Item
假设在控件列表中已经选定某项,现在要得到被选定项的内容,首先要得到该项的位置,然后得到对应位置的内容。这里会用到两个函数,如:
int nIndex = m_cbExample.GetCurSel();
CString strCBText;
m_cbExample.GetLBText( nIndex, strCBText);
这样,得到的内容就保存在 strCBText中。
若要选取当前内容,可调用函数GetWindowText(strCBText)。

function initBaseInfo() {$('#customer0').validatebox({required : true});$('#customerTel0').validatebox({required : true});if (null != '${model.customer}' && '' != '${model.customer}' && 'undefined' != '${model.customer}') {    $('#customer0').val('${model.customer}');    $('#customer0').validatebox('validate');    }    if (null != '${model.customerTel}' && '' != '${model.customerTel}' && 'undefined' != '${model.customerTel}') {    $('#customerTel0').val('${model.customerTel}');    $('#customerTel0').validatebox('validate');    }//客户区域(省)basicForm.find('#provinceForCustomerList').combobox({url : '${ctx}/customerList/customerList!getCustomerArea.action?customerArea=province',valueField : 'value',textField : 'detail',//panelHeight : 'auto',//width : '60',required : true,editable : true,missingMessage : "请选择省份",onSelect : function (data){getCity(data.value);$('#countryForCustomerList').combobox('clear');$('#countryForCustomerList').combobox('loadData',[]);}});


0 0
原创粉丝点击