EasyUI Forum
June 03, 2024, 08:31:26 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Question about positon of datagrid  (Read 8718 times)
nyr_jack
Newbie
*
Posts: 31


View Profile
« 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! 
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 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>
Logged
nyr_jack
Newbie
*
Posts: 31


View Profile
« Reply #2 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!
Logged
nyr_jack
Newbie
*
Posts: 31


View Profile
« Reply #3 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>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!