【编程技巧】ExtJs 设置GridPanel表格文本垂直居中

详细讲解见 http://blog.csdn.net/li396864285/article/details/9310983

 以下是我改修的代码:

{
         width:90,
         items:[{
          width:75,
          xtype:"button",
          iconCls:"btn-list",
          text:"查询",
          handler:function(){
           store.load({
               params: {start:0, limit: 15}
              });
           store.on('load',setTdCls);           
          }
         }]
  },

 

function setTdCls(){ 
     var gridJglb=document.getElementById("ext-comp-1026"); 
                 var tables = gridJglb.getElementsByTagName("table"); 
                  for(var k = 0; k < tables.length; k++){ 
                     var tableV=tables[k]; 
                    if(tableV.className=="x-grid3-row-table"){ 
                          var trs=tables[k].getElementsByTagName("tr"); //找到每个tr
                         for(var i = 0;i < trs.length;i++){ 
                              var tds=trs[i].getElementsByTagName("td"); //找到每个td
                              
                              var tdd=tds[0].getElementsByTagName("div");//找到每个div
                              tdd[0].style.marginTop="10px";   //设置居中无效,用marginTop代替
                              
                          } 
                     }; 
                  } 
              } 

posted @ 2013-08-02 11:40  ejllen  阅读(606)  评论(0编辑  收藏  举报