easyUi学习备忘

1.获取datagrid的自身相关的属性方式:

  jQuery("#grid").datagrid("options").height

  jQuery("#grid").datagrid("options").url

  即:通过jQuery("#grid").datagrid("options")对象就可以获取想要的属性值。

2.JQuery EasyUI内Combobox的onChange事件

  

<select id="modelState" class="easyui-combobox" data-options="width:100,panelHeight:'auto'" style="float:left;">

	            <option selected="selected">全部</option>

	            <option>未启动</option>

	            <option>执行中</option>

	            <option>已关闭</option>

	            <option>已归档</option>

	        </select>

 

// 可装载组合框 

			$("#modelState").combobox({

				onChange: function (n,o) {

					$("#grid").datagrid("load",{

						modelState:n!="全部" ? n :"",

						structureId:structureId,

						structurePath:modelPath,

						structureLevel:structureLevel

					});

					if($("#js_layout").layout("panel","south").is(":visible")){

					    $("#js_layout").layout("collapse","south");

		        	    $("button.layout-split-btn-v").hide();

		        	    $("#framebottom").attr("src","");

				    }

				}

			});

3.datagrid 添加title

 1 resizeColumnsFn: function(flag) {

 2             /*自动截取长度*/

 3             var fields = jQuery("#grid").datagrid('getColumnFields');

 4             for (var i = 0; i < fields.length; i++) {

 5                 var columnOption = jQuery("#grid").datagrid('getColumnOption', fields[i]);

 6                 var innerFields = $('td[field=' + fields[i] + '] div[class*=' + fields[i] + ']');

 7                 if (innerFields && columnOption && columnOption.width) {

 8                     innerFields.attr('style', 'overflow: hidden; white-space: nowrap; text-align: left;  text-overflow: ellipsis;');

 9                     if (flag) {

10                         for (var j = 0; j < innerFields.length; j++) {

11                             var el = $(innerFields[j]);

12                             if($.trim(el.text()).length > 0){ el.attr('title', el.text());}

13                         }

14                     }

15                 }

16             }

17         }
easyui 自动添加title

 

  

 

  

 

你可能感兴趣的:(easyui)