LigerUI的下拉框行和树的设置(表单生成)!


// ---------------------- // 【下拉树设置 -- 单选】

{display: "产品", name: "Variety_Name", comboboxName: "Variety_Name2", newline: true, labelWidth: 100, width: 180, space: 30, type: "select", options: { valueFieldID: "Variety_Id", tree: { url: "../handle/Class_CustomProducts_Handle.ashx?ajaxaction=Select_Class_Variety", checkbox: false} } },

//---------------------- // 【下拉树设置-- 多选框】

{display: "产品", name: "Variety_Name", comboboxName: "Variety_Name2", newline: true, labelWidth: 100, width: 180, space: 30, type: "select", options: { valueFieldID: "Variety_Id", tree: { url: "../handle/Class_CustomProducts_Handle.ashx?ajaxaction=Select_Class_Variety", checkbox: True} } },


//---------------------- // 【下拉行设置】

{display: "产品", name: "Variety_Name", comboboxName: "Variety_Name2", newline: true, labelWidth: 100, width: 180, space: 30, type: "select", options: { valueFieldID: "Variety_Id", url: "../handle/Class_CustomProducts_Handle.ashx?ajaxaction=Select_Class_Variety", checkbox: false } },


//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // 【下拉弹出选择窗口】


// ---------【1】

{display: "产品名称", name: "ProductId", comboboxName: "ProductId2", newline: true, labelWidth: 100, width: 150, space: 30, type: "select", option: { } },


//--------------- 注意:【option: { }】选项

//------【2 - 放在Form面】 -[设置下拉框的数据关联]

$.ligerui.get("ProductId2").set('onBeforeOpen', f_selectContact)

//------【3 - 放在body后面】


<div id="productdetail" style="display:none;"> <%--【弹出产品选择窗口】--%>
<div class="searchbox">
<form class="l-form">
<table>
<tr>
<td>助记码:</td><td style="width:155px"><input type="text" id="helpcodetext"/></td>
<td ><a href="javascript:void(0)" class="l-button" style="width:100px" onclick='GetClassProduct()'>查询</a></td>
<td> &nbsp;&nbsp; </td>
<td><a href="javascript:void(0)" class="l-button" style="width:100px" onclick='GetClassProductAll()'>全部显示</a></td>

</tr>
</table>
</form>
</div>
<div id="productgrid" style="margin:0px;"></div>

</div>

//------【4】

// #region ===========================================================【弹出选择产品js函数 - 放在<script type="text/javascript">下面】

var productdetail = null;
// 【弹出产品选择窗口】
function f_selectContact()
{
if (productdetail) {
productdetail.show();


}
else {
productdetail = $.ligerDialog.open
({
target: $("#productdetail"),
width: 624, height: 465, top: 15, title: "选择产品",
buttons: [
{ text: '选择', onclick: function () { selectproduct(); } },
{ text: '取消', onclick: function () { productdetail.hide(); } }
]
});


}
return false;
}
// 【将选择的产品赋值到选择框】
function selectproduct()
{
var selected = productgrid.getSelected();
if (selected) {


$("#Product_Name2").val(selected.Product_Name)
$("#Product_Name1").val(selected.Product_Id)


productdetail.hide();
}
else {
LG.tip('请选择行!');
}
}
// 【产品助记码查询事件】
function GetClassProduct()
{
var helpcode = $("#helpcodetext").val();
// if (helpcode == "") return;
productgrid.set('url', rootPath + 'handle/Class_CustomProducts_Handle.ashx?ajaxaction=Get_Class_Product&HelpCode=' + helpcode);
}
// 【全部查询事件】
function GetClassProductAll()
{
var helpcode = "SelectAll";
// if (helpcode == "") return;
productgrid.set('url', rootPath + 'handle/Class_CustomProducts_Handle.ashx?ajaxaction=Get_Class_Product&HelpCode=' + helpcode);
}


// 【产品选择表格设置】
$("#helpcodetext").ligerTextBox({ width: 150 });
var productgrid = $("#productgrid").ligerGrid({
columns: [
{ display: "产品名称", name: "Product_Name", width: 200, type: "text", align: "left" },
{ display: "助记码", name: "HelpCode", width: 150, type: "textarea", align: "left" }, //【助记码-1】
{display: "产品描述", name: "Remark", width: 400, type: "textarea", align: "left" }


],


// ---------------------------------------- // 双击选择代码 = 【开始】


onDblClickRow: function (data, rowindex, rowobj) {
selectproduct();
},


// ---------------------------------------- // 双击选择代码 = 【结束】
dataAction: 'local', pageSize: 20,
url: rootPath + 'handle/Class_CustomProducts_Handle.ashx?ajaxaction=Get_Class_Product&HelpCode=' + 'SelectAll', sortName: 'Sort',
tree: { columnName: 'Product_Name' },
width: '600', height: '370', heightDiff: -10, checkbox: false
});




//#endregion





你可能感兴趣的:(下拉框)