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" οnclick='GetClassProduct()'>查询</a></td>
<td> &nbsp;&nbsp; </td>
<td><a href="javascript:void(0)" class="l-button" style="width:100px" οnclick='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





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值