【发布时间】:2020-02-01 14:38:45
【问题描述】:
我想在一个网格中显示复选框和数据标签,以便标签是只读的,复选框是可点击的,并且它们的结果可发送到 PHP 后端。此窗口的目的是将订单中的一些文章与图片标签相关联。
EXT JS with Ext.grid.ColumnModel:
setCM : function(){
var checkColumn = new Ext.grid.CheckColumn({
header: 'Choix',
dataIndex: 'NOM_LOGO',
align : 'center',
width: 50
});
// add the column to the column model
this.cm = new Ext.grid.ColumnModel([
checkColumn,
{
header: 'Nom Logo',
dataIndex: 'NOM_LOGO'
}
]);
},
EXT JS without Ext.grid.ColumnModel and with renderer:
setCM : function(){
this.cm = new Ext.grid.ColumnModel({
columns: [
{
dataIndex: 'NOM_LOGO',
name: 'LOGO_PRODUIT_ASSOCIE',
width: 50,
renderer: function(value, meta) {
var checked = (value == 1 ? 'checked = "checked"' : '');
return '<input type="checkbox" value="'+value+'" '+checked+' />';
}
},{
header: "Nom Logo",
dataIndex: 'NOM_LOGO',
width: 300
}]
});
},
PHP function :
private function editerLogosCommandeProduit($nocde, $codpro, $lstLogosAssocies) {
$this->dissocierLogosProduit($nocde, $codpro);
if (is_array($lstLogosAssocies) && (count($lstLogosAssocies) > 0)) {
$this->associerLogosProduit($nocde, $codpro, $lstLogosAssocies);
}
}
Actually, those things are observed:
-> Whether I use the Ext.grid.CheckColumn Class and checboxes are displayed but not clickable
-> Whether I use the Renderer function in Ext JS which is easier to use but I don't know how to send data to PHP. Furthermore, even if I add the name porperty in the checkbox, it does not appear in the HTML Inspection in the browser.
【问题讨论】:
-
我的意思是复选框值
-
我很乐意提供帮助,但我是一个原始的 PHP/Javascript 人,这个扩展对我来说完全没有意义。希望它会有人!据我所知,您的复选框上似乎缺少名称? 猜测一下。
标签: javascript php extjs4.2