1. 程式人生 > >easyui 表頭豎著顯示

easyui 表頭豎著顯示

當遇到表頭欄位比較多,而資料項比較少的時候,橫向顯示有時候不方便

需要豎著顯示。

可以如下展示

function daydetailmethod(id){
var rows = [];
$.ajax({
url:path+"/xxxx/xxxxx?id="+id,
type:"post",
dataType:"json",
async:false,
success:function(data){
rows =[ 
{ "name": "day1", "group": "帳號", "value": ""+data.rows[0].colun1+"", "editor": "" },
{ "name": "day2", "group": "帳號", "value": ""+data.rows[0].colum2+"", "editor": "" }

];
}
})

$("#name").propertygrid({  
           
            showGroup:false,
            fit:true,//自動補全  
        
            columns: [[
                { field: 'name', title: '天數', width: 100, resizable: true },
                { field: 'value', title: '人數', width: 100, resizable: false }
        ]],

      onLoadSuccess: function (data) {
     $("#daydetail").window('open');
     },  
   onLoadError:function(data){
      alert("查詢失敗");
  }
}) 

$('#name').propertygrid('loadData', rows);  
}

這裡面需要注意一下,ajax 的同步非同步,

editor 屬性是編輯, text  具體可參考easyui