详细讲解见 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代替
}
};
}
}