Show Posts
|
Pages: 1 ... 149 150 [151]
|
2252
|
General Category / EasyUI for jQuery / Re: datagrid column fit to available width
|
on: May 27, 2014, 07:03:28 AM
|
First of all, set the 'fitColumns' property to true for the datagrid, and then set the 'fixed:true' for all the columns except the final column. The code looks like this: <table id="dg" class="easyui-datagrid" title="Basic DataGrid" style="width:700px;height:250px" data-options=" fitColumns:true, singleSelect:true,url:'datagrid_data1.json',method:'get'"> <thead> <tr> <th data-options="field:'itemid',width:80,fixed:true">Item ID</th> <th data-options="field:'productid',width:60,fixed:true">Product</th> <th data-options="field:'listprice',width:80,align:'right',fixed:true">List Price</th> <th data-options="field:'unitcost',width:80,align:'right',fixed:true">Unit Cost</th> <th data-options="field:'attr1',width:150">Attribute</th> </tr> </thead> </table>
|
|
|
2259
|
General Category / EasyUI for jQuery / Re: Numberbox format to 5 or 5.1 not 5.0
|
on: May 22, 2014, 08:28:07 AM
|
If you want to do some special conversions, you have to customize the 'formatter' and 'parser' functions. The code below achieves how to round a number downwards to the nearest integer. {field:'ano1',title:'ANO 1',width:70,align:'center', editor:{ type:'numberbox', options:{ formatter:function(v){ return v; }, parser:function(s){ var v = parseFloat(s); return isNaN(v)?'':Math.floor(v); } } } },
|
|
|
2261
|
General Category / EasyUI for jQuery / Re: How to disable validatebox
|
on: May 22, 2014, 01:30:07 AM
|
Yes, you can disable a input box. <input type id="unitId" name="unit" disabled="disabled"></input>
A disabled input box has no validating actions on it but can't accept any entering chars. If you only want to disable the validation, set 'novalidate' property to true. $('#unitId').validate({ novalidate:true });
|
|
|
2263
|
General Category / EasyUI for jQuery / Re: Datagrid column sizing programatically
|
on: May 21, 2014, 05:52:41 PM
|
Extending a new method to achieve this functionality may be a better way. The code below is the implementation of 'resizeColumn' method that can be used to resize a column programmatically. $.extend($.fn.datagrid.methods,{ resizeColumn:function(jq,param){ return jq.each(function(){ var dg = $(this); var col = dg.datagrid('getColumnOption', param.field); col.boxWidth = param.width + (col.boxWidth-col.width); col.width = param.width; dg.datagrid('fixColumnSize', param.field); }) } })
For example, to resize the 'itemid' column's size, you can call 'resizeColumn' method. The code looks like this: $('#mygrid').datagrid('resizeColumn', { field: 'itemid', width: 200 });
|
|
|
|