Title: Question about positon of datagrid Post by: nyr_jack on September 14, 2012, 01:48:54 AM Is there attribute like align in datagrid?I want to make datagrid to center in window or in panel. Or maybe other methods can show me, help me, thanks!
Title: Re: Question about positon of datagrid Post by: stworthy on September 14, 2012, 10:03:40 PM A simple way is to place the datagrid in a center div.
<div class="center"> <table class="easyui-datagrid"></table> </div> Title: Re: Question about positon of datagrid Post by: nyr_jack on September 16, 2012, 06:22:57 PM <script>
$(function(){ $('#contractGrid').datagrid({ url:'data/contract_data.json', //fit: true, width:826, height:'auto', remoteSort:false, fitColumns:false, nowrap:true, collapsible:true, striped: true, border: true, idField:'contractnum', sortName:'contractnum', columns:[[ {field:'ck',checkbox:true}, {field:'contractnum',title:'contractnum',width:80,sortable:true,align:'left'}, {field:'contractname',title:'contractname',width:150,align:'left', formatter:function(value,rowData,rowIndex){ return "<a href='../htgl/contractBaseInfo.html' title='" + rowData.contractname + "'>" + rowData.contractname + "</a>"; } }, {field:'contracttypeid',title:'contracttypeid,hidden:'true'}, {field:'contracttypename',title:'contracttypename',width:120,align:'left'}, {field:'contractdate',title:'contractdate',width:80,align:'left'} ]], rownumbers:true }); }); </script> <html> <body> <div class="center"> <table id="contractGrid" class="easyui-datagrid"></table> </div> Up is my code, but it's not work, the datagrid can not be placed in a center div. my easyui version is 1.3, jquery is 1.7.2. maybe I do something else wrong? please help,thanks! Title: Re: Question about positon of datagrid Post by: nyr_jack on September 16, 2012, 07:40:45 PM Problem has resolved!
Try do this: <div style="margin-left:auto;margin-right:auto;width:datagrid's width;"></div> |