//一级grid
grid = new Ext.grid.EditorGridPanel( {
title :'需求明细 ',
store :ds, // 数据集的VarName
columns :columns, // Grid列定义VarName
sm : new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
// sm : grid_sm2,
autoHeight : true,
// height : sHeight,
autoWidth : true,
renderTo :'SoApplyItemInfoGrid', // html页面中调用GRID-DIV-ID
tbar : new Ext.Toolbar({
items : [{hidden:true},
{hidden:false,text:'添加明细',handler:selectMaterialSpec},
{hidden:false,text:'删除明细',handler:deleteMaterialCategory},
{hidden:true ,text:'保存明细',handler:checkItem},
{hidden:false,text:'推荐供应商',handler:recommendProvider},
{hidden:false,text:'删除供应商',handler:delSoApplyItemProvider}]
}),
plugins : [expander]
});
//下面加入二级grid
var expander = new Ext.grid.RowExpander({ tpl : new Ext.XTemplate('<div class="re" >', '', '</div>')
})
array = new Array(grid.getStore().getCount());
expander.on("collapse", function(expander, r, body, rowIndex) {
array.splice(rowIndex, 1, null);
}); expander.on("expand", function(expander, r, body, rowIndexBox) {
soApplyItemId = grid.getStore().getAt(rowIndexBox).data.id;
//TODO 是否为期货物资的标识
var isFutureMaterial = grid.getStore().getAt(rowIndexBox).data.isFutureMaterial;
if(soApplyItemId<0){
return false;
}else{
window.testEle = body;
if (Ext.DomQuery.select("div.x-panel-bwrap", body).length == 0) {
var record_soApply_provider = Ext.data.Record.create([{
name : 'id',
type : 'int'
}, {
name : 'applyItemId',
type : 'int'
}, {
name : 'providerId',
type : 'string'
}, {
name : 'contractId',
type : 'string'
}, {
name : 'contractName',
type : 'string'
}, {
name : 'providerName',
type : 'string'
}, {
name : 'amountStr',
type : 'string'
}, {
name : 'priceY',
type : 'string'
}]);
var columns_soApply_provider = [new Ext.grid.CheckboxSelectionModel(), {
header : '供应商名称',
width : 200,
dataIndex : 'providerName',
align : 'center',
hidden : false }, {
header : '数量',
width : 200,
dataIndex : 'amountStr',
align : 'center',
hidden : false,
editor :new Ext.form.NumberField({
allowNegative: false, // 不允许为负数
decimalPrecision: 4, // 默认的小数点位数
allowDecimals: true, // 不允许为负数
allowBlank :false
}),
renderer : function(v) {
return '<input type="text" readonly="readonly" value="'+v+'">';
}
}, {
header : '单价(元)',
width : 200,
dataIndex : 'priceY',
align : 'center',
hidden : false,
editor : new Ext.form.NumberField({
allowNegative : false, // 不允许为负数
decimalPrecision : 4,
allowBlank : true
}),
renderer : function(v) {
return '<input type="text" readonly="readonly" value="'+v+'">';
}
},{
header : '框架协议名称',
width : 400,
dataIndex : 'contractName',
align : 'center',
hidden : false,
renderer : function(value,metadata,record){
if(value==""){
return "<a href='javascript:addContract("+record.get('providerId')+","+record.get('applyItemId')+");'><img src='../images/ico_bt.gif' class='bt_img'/>选择</a>";
}else{
return "<a href='javascript:viewContract("+record.get('contractId')+");'>"+value+"</a>";
}
}
}]; var ds_soApply_provider = new Ext.data.Store({
url : path
+ '/soapply/queryItemProviderByMap.do?soApplyItemId='
+ soApplyItemId,
reader : new Ext.data.JsonReader({
id : 'providerId',//由于表R_SO_APPLY_ITEM_PROVIDER没有主键,那么同一条需求明细,只有供应商ID是唯一的,所以只能以它来标识
root : 'soApplyItemProviderDTOs'
}, record_soApply_provider)
});
ds_soApply_provider.load(); var soApplyProviderDiv = new Ext.grid.EditorGridPanel({
// title : '合同供应商',
url : path + '/cgorderitemprovider/batchUpdate.do', // 保存的时候提交到的服务端链接
store : ds_soApply_provider, // 数据集的VarName
columns : columns_soApply_provider, // Grid列定义VarName
sm : new Ext.grid.CheckboxSelectionModel({
singleSelect : false
}),
autoHeight : true,
//height : 100,
renderTo : Ext.DomQuery.select("div.re", body)[0]
});
} 现在的问题是选中一级的复选框,二级的复选框就会被选中,怎么能在选中一级复选框的时候二级不被选中呢?一级跟二级复选框并不存在父子关系啊
grid = new Ext.grid.EditorGridPanel( {
title :'需求明细 ',
store :ds, // 数据集的VarName
columns :columns, // Grid列定义VarName
sm : new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
// sm : grid_sm2,
autoHeight : true,
// height : sHeight,
autoWidth : true,
renderTo :'SoApplyItemInfoGrid', // html页面中调用GRID-DIV-ID
tbar : new Ext.Toolbar({
items : [{hidden:true},
{hidden:false,text:'添加明细',handler:selectMaterialSpec},
{hidden:false,text:'删除明细',handler:deleteMaterialCategory},
{hidden:true ,text:'保存明细',handler:checkItem},
{hidden:false,text:'推荐供应商',handler:recommendProvider},
{hidden:false,text:'删除供应商',handler:delSoApplyItemProvider}]
}),
plugins : [expander]
});
//下面加入二级grid
var expander = new Ext.grid.RowExpander({ tpl : new Ext.XTemplate('<div class="re" >', '', '</div>')
})
array = new Array(grid.getStore().getCount());
expander.on("collapse", function(expander, r, body, rowIndex) {
array.splice(rowIndex, 1, null);
}); expander.on("expand", function(expander, r, body, rowIndexBox) {
soApplyItemId = grid.getStore().getAt(rowIndexBox).data.id;
//TODO 是否为期货物资的标识
var isFutureMaterial = grid.getStore().getAt(rowIndexBox).data.isFutureMaterial;
if(soApplyItemId<0){
return false;
}else{
window.testEle = body;
if (Ext.DomQuery.select("div.x-panel-bwrap", body).length == 0) {
var record_soApply_provider = Ext.data.Record.create([{
name : 'id',
type : 'int'
}, {
name : 'applyItemId',
type : 'int'
}, {
name : 'providerId',
type : 'string'
}, {
name : 'contractId',
type : 'string'
}, {
name : 'contractName',
type : 'string'
}, {
name : 'providerName',
type : 'string'
}, {
name : 'amountStr',
type : 'string'
}, {
name : 'priceY',
type : 'string'
}]);
var columns_soApply_provider = [new Ext.grid.CheckboxSelectionModel(), {
header : '供应商名称',
width : 200,
dataIndex : 'providerName',
align : 'center',
hidden : false }, {
header : '数量',
width : 200,
dataIndex : 'amountStr',
align : 'center',
hidden : false,
editor :new Ext.form.NumberField({
allowNegative: false, // 不允许为负数
decimalPrecision: 4, // 默认的小数点位数
allowDecimals: true, // 不允许为负数
allowBlank :false
}),
renderer : function(v) {
return '<input type="text" readonly="readonly" value="'+v+'">';
}
}, {
header : '单价(元)',
width : 200,
dataIndex : 'priceY',
align : 'center',
hidden : false,
editor : new Ext.form.NumberField({
allowNegative : false, // 不允许为负数
decimalPrecision : 4,
allowBlank : true
}),
renderer : function(v) {
return '<input type="text" readonly="readonly" value="'+v+'">';
}
},{
header : '框架协议名称',
width : 400,
dataIndex : 'contractName',
align : 'center',
hidden : false,
renderer : function(value,metadata,record){
if(value==""){
return "<a href='javascript:addContract("+record.get('providerId')+","+record.get('applyItemId')+");'><img src='../images/ico_bt.gif' class='bt_img'/>选择</a>";
}else{
return "<a href='javascript:viewContract("+record.get('contractId')+");'>"+value+"</a>";
}
}
}]; var ds_soApply_provider = new Ext.data.Store({
url : path
+ '/soapply/queryItemProviderByMap.do?soApplyItemId='
+ soApplyItemId,
reader : new Ext.data.JsonReader({
id : 'providerId',//由于表R_SO_APPLY_ITEM_PROVIDER没有主键,那么同一条需求明细,只有供应商ID是唯一的,所以只能以它来标识
root : 'soApplyItemProviderDTOs'
}, record_soApply_provider)
});
ds_soApply_provider.load(); var soApplyProviderDiv = new Ext.grid.EditorGridPanel({
// title : '合同供应商',
url : path + '/cgorderitemprovider/batchUpdate.do', // 保存的时候提交到的服务端链接
store : ds_soApply_provider, // 数据集的VarName
columns : columns_soApply_provider, // Grid列定义VarName
sm : new Ext.grid.CheckboxSelectionModel({
singleSelect : false
}),
autoHeight : true,
//height : 100,
renderTo : Ext.DomQuery.select("div.re", body)[0]
});
} 现在的问题是选中一级的复选框,二级的复选框就会被选中,怎么能在选中一级复选框的时候二级不被选中呢?一级跟二级复选框并不存在父子关系啊
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货