关于Ext Table布局的问题 tablelayout中如何让列里面的元素居中 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 align 属性设置成 center这样 列头和内容都会居中如果 想列头居中 列内容居左或者具有 需要自己在renderer 中自己实现以下 比如加div 设置内容居左等 Ext.onReady(function(){ var table = new Ext.Panel({ title:'集装箱运输委托', renderTo:Ext.getBody(), layout:'table', defaults:{ // 对每一个子面板都有效applied to each contained panel bodyStyle:'border:0' }, layoutConfig:{ columns:6 }, items:[ {html:'提运单号:'}, {html:'<input type="text" name="" id="" />'}, {html:'客户单证号:'}, {html:'<input type="text" name="" id="" />'}, {html:''}, {html:''}, {html:'客户名称:'}, {html:'<input type="text" name="" id="" />'}, {html:'业务来源:'}, {html:'<select name="select"><option>请选择</option><option>选择一</option></select>'}, {html:'业务类型:'}, {html:'<select name="select"><option>请选择</option><option>选择一</option></select>'}, {html:'接单时间:'}, {html:'<input type="text" name="" id="" />-<input type="text" name="" id="" />'}, {html:'船名/航次:'}, {html:'<input type="text" name="" id="" />'}, {html:'单据状态:'}, {html:'<select name="select"><option>请选择</option><option>选择一</option></select>'}, {html:'要求到达时间:'}, {html:'<input type="text" name="" id="" />-<input type="text" name="" id="" />'}, {html:'起运地:'}, {html:'<input type="text" name="" id="" />'}, {html:'目的地:'}, {html:'<input type="text" name="" id="" />'}, {html:'<input type="submit" name="Submit" value="提交" /> <input type="submit" name="Submit" value="取消" />',colspan:6} ] });});以上是我的JS代码 大哥能不能具体给段代码我看看 1、panel 加 id 比如 id:'main-table'2 页面加入样式设置 <style type="text/css"> #main-table td{text-align :center;}<style/> 咱是初学者,加入CSS还不会弄,不能直接在列里面设置吗? 这个是改变ext 生成的td 的样式 你看不到的 直接把我那句话 考到你的html页面或者jsp页面里 你这样做把所有的td都居中了,我只要其中的某一个td居中就可以了,这个要怎么做? 01 <script type="text/javascript"> 02 function getBodyWidth(){ 03 return document.body.clientWidth-15; 04 } 05 06 function func_submit_onclick(){ 07 alert('hello'); 08 } 09 var _bodyWidth = getBodyWidth(); 10 //var _bodyWidth=900; 11 var _columns = 3 * 2; 12 var _perWidth = _bodyWidth/_columns; 13 14 Ext.onReady(function(){ 15 16 Ext.QuickTips.init(); 17 var tableForm=new Ext.FormPanel({ 18 name:'tableForm', 19 id:'tableForm', 20 frame:true, 21 //width:_bodyWidth+30, 22 layout:'table', 23 style:'height:100%', 24 //bodyStyle: 'padding:8px 0 0 0;' , //上-右-下-左 25 layoutConfig: {columns:_columns}, 26 title:'TableForm', 27 defaults:{border:false,bodyStyle: 'padding:8px 0 0 0;', 28 layout:'form',frame:false,labelAlign:'right',labelWidth:75,width:_perWidth*2,height:30 29 } 30 }); 31 tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}}); 32 tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}}); 33 tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}}); 34 35 tableForm.add({colspan:1,width:_perWidth,items:{xtype:'datefield',fieldLabel:'First Name',anchor:'100%'}}); 36 tableForm.add({colspan:1,width:_perWidth,labelAlign:'center',items:{xtype:'datefield',fieldLabel:'to',anchor:'100%'}}); 37 tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}}); 38 tableForm.add({colspan:2,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}}); 39 40 tableForm.add({colspan:2,items:{xtype:'hidden',fieldLabel:'First Name',anchor:'100%'}}); //隐藏列,用于空白列布局 41 tableForm.add({colspan:4,width:_perWidth*4,items:{xtype:'textfield',fieldLabel:'First Name',anchor:'100%'}}); 42 43 tableForm.addButton({text:'submit',handler:func_submit_onclick}); 44 tableForm.addButton({text:'cancel'}); 45 46 tableForm.render(Ext.getBody()); 47 48 }); 49 </script> 读卡器控件读卡操作问题 strust2.0 token标签 首次就报错! 与struts1相比struts2不足之处 关于学习ActiveMQ请教 Hibernate配置问题请教. Hibernate中如何获取某个字段的全部值 请问<ul></ul>这对标签是什么功能啊? 在jtable如何取得当前选中行的下一行?谢谢。 哪儿有Weblogic6.1 license? 大家平时整合SSH导入包都是自己手动导入的吗? myeclipse在jsp页面中引用<jsp:include >假死 为什么web.xml中taglib标签会报错
这样 列头和内容都会居中如果 想列头居中 列内容居左或者具有 需要自己在renderer 中自己实现以下 比如加div 设置内容居左等
var table = new Ext.Panel({
title:'集装箱运输委托',
renderTo:Ext.getBody(),
layout:'table',
defaults:{
// 对每一个子面板都有效applied to each contained panel
bodyStyle:'border:0'
},
layoutConfig:{
columns:6
},
items:[
{html:'提运单号:'},
{html:'<input type="text" name="" id="" />'},
{html:'客户单证号:'},
{html:'<input type="text" name="" id="" />'},
{html:''},
{html:''},
{html:'客户名称:'},
{html:'<input type="text" name="" id="" />'},
{html:'业务来源:'},
{html:'<select name="select"><option>请选择</option><option>选择一</option></select>'},
{html:'业务类型:'},
{html:'<select name="select"><option>请选择</option><option>选择一</option></select>'},
{html:'接单时间:'},
{html:'<input type="text" name="" id="" />-<input type="text" name="" id="" />'},
{html:'船名/航次:'},
{html:'<input type="text" name="" id="" />'},
{html:'单据状态:'},
{html:'<select name="select"><option>请选择</option><option>选择一</option></select>'},
{html:'要求到达时间:'},
{html:'<input type="text" name="" id="" />-<input type="text" name="" id="" />'},
{html:'起运地:'},
{html:'<input type="text" name="" id="" />'},
{html:'目的地:'},
{html:'<input type="text" name="" id="" />'},
{html:'<input type="submit" name="Submit" value="提交" /> <input type="submit" name="Submit" value="取消" />',colspan:6}
]
});
});以上是我的JS代码 大哥能不能具体给段代码我看看