ExtJS - 将外部参数传递到网格渲染器中
有没有办法将外部参数传递到网格渲染器函数中?
例如,考虑到..
function excelRenderer(value, p,record){
return String.format('<a href="excel.jsp?view=aging&prod_type={0}&value={1}" target="_blank"><img src="images/excel.png" border="0"/></a>',record.data.prod_type,value);
}
function newtab(status){
//add tab
tabs.add({
...
items: new Ext.grid.GridPanel({
region:'center',
frame: true,
title: 'testing',
store: new Ext.data.Store({
...
}),
columns: [
{header: "Column 2", dataIndex: 'col2', sortable: true, renderer: excelRenderer},
{header: "Column 1", dataIndex: 'col1', sortable: true, renderer: excelRenderer}
]
}
}
现在我想将外部参数 status
添加到渲染器中,以便渲染的 URL 看起来像
excel.jsp?view=aging&prod_type=data&value=testing
&status=pending
非常感谢任何帮助。谢谢
is there a way to pass external parameter into Grid renderer function?
For example, considering..
function excelRenderer(value, p,record){
return String.format('<a href="excel.jsp?view=aging&prod_type={0}&value={1}" target="_blank"><img src="images/excel.png" border="0"/></a>',record.data.prod_type,value);
}
function newtab(status){
//add tab
tabs.add({
...
items: new Ext.grid.GridPanel({
region:'center',
frame: true,
title: 'testing',
store: new Ext.data.Store({
...
}),
columns: [
{header: "Column 2", dataIndex: 'col2', sortable: true, renderer: excelRenderer},
{header: "Column 1", dataIndex: 'col1', sortable: true, renderer: excelRenderer}
]
}
}
now I want to add external parameter status
into the renderer so that the URL rendered will look like
excel.jsp?view=aging&prod_type=data&value=testing
&status=pending
Any help is much appreciated. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将渲染器函数定义移至
newTab()
函数体内:还有其他一些方法(例如,创建绑定到补充参数
的
),但这似乎是最简单的方法。excelRenderer
函数回调) status编辑(使用绑定参数的第二个选项):
Move the renderer function definition inside the
newTab()
function body:There are some other ways (e.g. creating a function callback to
excelRenderer
that's being bound to a supplemental parameterstatus
), but this seems to be the easiest way.EDIT (second option using bound parameters):