Extjs 怎么在文字前添加图片啊 (小弟刚接触Extjs)

Extjs 怎么在文字前添加图片啊 (小弟刚接触Extjs),第1张

上面说的加css是一个办法。但是有点画蛇添足的感觉。

extjs 按钮等图标,都已经有属性。

比如一个button

var button = new Ext.Button({

text : 'newbutton',

icon : 'image/xxx/xxx.png',

handler : function(){

xxxxx

}

})

这样就可以了

最好使用 actioncolumn , 显示效果一样...但是设置点击事件要方便的多, 可以查看下API

//下面代码是直接复制的API例子Ext.create('Ext.data.Store', { storeId:'employeeStore', fields:['firstname', 'lastname', 'seniority', 'dep', 'hired'], data:[ {firstname:"Michael", lastname:"Scott"}, {firstname:"Dwight", lastname:"Schrute"}, {firstname:"Jim", lastname:"Halpert"}, {firstname:"Kevin", lastname:"Malone"}, {firstname:"Angela", lastname:"Martin"} ]})Ext.create('Ext.grid.Panel', { title: 'Action Column Demo', store: Ext.data.StoreManager.lookup('employeeStore'), columns: [ {text: 'First Name', dataIndex:'firstname'}, {text: 'Last Name', dataIndex:'lastname'}, { xtype:'actioncolumn', width:50, items: [{ //这里直接通过URL设置图标 icon: 'extjs/examples/shared/icons/fam/cog_edit.png', tooltip: 'Edit', //这里是图标的点击事件 //参数中有点击行的record , 所以很方便做处理 handler: function(grid, rowIndex, colIndex) { var rec = grid.getStore().getAt(rowIndex)alert("Edit " + rec.get('firstname'))} },{ icon: 'extjs/examples/restful/ima ges/delete.png', tooltip: 'Delete', handler: function(grid, rowIndex, colIndex) { var rec = grid.getStore().getAt(rowIndex)alert("Terminate " + rec.get('firstname'))} }] } ], width: 250, renderTo: Ext.getBody()})


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/bake/7914377.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-11
下一篇2023-04-11

发表评论

登录后才能评论

评论列表(0条)

    保存