Javascript 显示带有复选框和标签的柱网,以便复选框可以单击并发送到PHP
我想在一个网格中显示复选框和数据标签,这样标签是只读的,复选框是可点击的,它们的结果可以发送到PHP后端。此窗口的用途是将订单中的某些物品与图片标签相关联Javascript 显示带有复选框和标签的柱网,以便复选框可以单击并发送到PHP,javascript,php,extjs4.2,Javascript,Php,Extjs4.2,我想在一个网格中显示复选框和数据标签,这样标签是只读的,复选框是可点击的,它们的结果可以发送到PHP后端。此窗口的用途是将订单中的某些物品与图片标签相关联 EXT JS with Ext.grid.ColumnModel: setCM : function(){ var checkColumn = new Ext.grid.CheckColumn({ header: 'Choix', dataIndex: 'NOM_L
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.
EXT-JS和EXT.grid.ColumnModel:
setCM:function(){
var checkColumn=new Ext.grid.checkColumn({
标题:“Choix”,
dataIndex:'NOM_徽标',
对齐:'居中',
宽度:50
});
//将柱添加到柱模型中
this.cm=新的Ext.grid.ColumnModel([
检查列,
{
标题:“Nom徽标”,
数据索引:“NOM_徽标”
}
]);
},
不带EXT.grid.ColumnModel和渲染器的EXT JS:
setCM:function(){
this.cm=新的Ext.grid.ColumnModel({
列:[
{
dataIndex:'NOM_徽标',
名称:'LOGO_PRODUIT_ASSOCIE',
宽度:50,
渲染器:函数(值、元){
var checked=(值==1?'checked=“checked”:“”);
返回“”;
}
},{
标题:“名称标志”,
dataIndex:'NOM_徽标',
宽度:300
}]
});
},
PHP函数:
私有函数编辑器logoscommandeproduit($nocde、$codpro、$lstLogosAssocies){
$this->dissocierLogosProduit($nocde,$codpro);
if(is_数组($lstLogosAssocies)&&(计数($lstLogosAssocies)>0)){
$this->associerLogosProduit($nocde、$codpro、$lstLogosAssocies);
}
}
事实上,这些事情是可以观察到的:
->是否使用Ext.grid.CheckColumn类和复选框将显示但不可单击
->我是否使用ExtJS中的Renderer函数,它更容易使用,但我不知道如何将数据发送到PHP。此外,即使我在复选框中添加了名称porperty,它也不会出现在浏览器的HTML检查中。
我的意思是复选框值我很乐意提供帮助,但我是一个纯PHP/Javascript的人,这种扩展对我来说毫无意义。希望它会给某个人!据我所知,你的复选框上好像没有名字?凭猜测
var checkLogo = new Ext.grid.CheckColumn({
dataIndex: 'CHECKED',
editable: true,
width: 28,
});
setCM : function(){
this.cm = new Ext.grid.ColumnModel({
columns: [
checkLogo,
{
header: "Nom Logo",
dataIndex: 'NOM_LOGO',
width: 300
}]
});
}