当前位置: 首页 > 工具软件 > jQuery MiniUI > 使用案例 >

jquery miniUi使用小结

谭嘉歆
2023-12-01

感觉挺好使的,顺便记录下,方便下次使用。

1:获取选中行: var row = grid.getSelected();
2:获取多行:var rows = grid.getSelecteds();
3:行操作:
  <div name="action" width="120" headerAlign="center" align="center" renderer="onActionRenderer" cellStyle="padding:0;">操作</div>
function onActionRenderer(e) {
            var grid = e.sender;
            var record = e.record;
            var uid = record._uid;
            var rowIndex = e.rowIndex;
            var s = 
            ' <a class="Edit_Button" href="JavaScript:editRow(\'' + uid + '\')" >字段编辑</a>' +
            ' <a class="Edit_Button" href="javascript:conditRow(\'' + uid + '\')" >条件编辑</a>'+
            ' <a class="Edit_Button" href="javascript:showRow(\'' + uid + '\')" >查看星形模型</a>'
             ;
            return s;
        }
 //查看星形模型
        function showRow(row_uid) {
  //根据UID获取行
            var row = grid.getRowByUID(row_uid);
             window.open("/pisa/drawGraph/StartModel.jsp?modelId="+row.tblCode);
        }

4:打开子窗口:
function conditRow(row_uid) {
            var row = grid.getRowByUID(row_uid);
              mini.open({
                     url: "conditEdit.action",
                     title: "条件编辑", width: 1000, height: 500,
                     onload: function () {
                         var iframe = this.getIFrameEl();
    //父窗口向子窗口传值;
                         var data = { action: "edit", tblCode: row.tblCode,tblName: row.tblName,sysCode:row.SYSCODE};
                         iframe.contentWindow.SetData(data);
                        
                     },
                     ondestroy: function (action) {
                         grid.reload();
                        
                     }
                 });
        }
子窗口接收参数,使用统一接口:
//标准接口
         function SetData(data) {
            if (data.action == "edit") {
                //跨页面传递的数据对象,克隆后才可以安全使用
                data = mini.clone(data);
              $("#tblCode").val(data.tblCode);
              $("#tblName").val(data.tblName);
              $("#sysCode").val(data.sysCode);
              grid.load({tblCode:data.tblCode});
            }
        }
5:grid列表查询
function search() {
            var tblCode = mini.get("tblCode").getValue();
            var tblName = mini.get("tblName").getValue();
            grid.load({ tblCode: tblCode,tblName:tblName });
        }

        function onKeyEnter(e) {
            search();
        }
6:oncellcommitedit="OnCellCommitEdit" 单元格编辑后执行的操作

function OnCellCommitEdit(e) {
            var grid = e.sender;
            var record = e.record;
            var field = e.field, value = e.value;
             var uid = record._uid;
              var row = grid.getRowByUID(uid);
           if(field=="isString"){
                    if (value == "T") {
                     grid.updateRow(record, { isDim: "T", isDim_name: "维度" });
              }else{
                      grid.updateRow(record, { isDim: "F", isDim_name: "度量" });
              }
                }
                if(field=="isDim"){
                    if (value == "T") {
                     grid.updateRow(record, { isString: "T", isString_name: "是" });
              }else{
                      grid.updateRow(record, { isString: "F", isString_name: "否" });
              }
                }

 类似资料: