extjs单行编辑RowEditing修改后台部分的东西后前端写法
来源:互联网 发布:java打印数字菱形 编辑:程序博客网 时间:2024/05/22 16:47
function product_row_cost(field){ //当有focus时,被监听调用的方法,取所在行数
product_grid_row=product_info_grid.getSelectionModel().getSelection();
}
if(e.getKey()==39 || e.getKey()==13) //当按下键keypress时,监听回车和向右的按钮
{
Ext.getCmp('cname_row').focus(true,true); //会直接进入下一个右侧输入框
}
}
Ext.getCmp('sku_no_row').focus(true,true);
}
else
if(e.getKey()==39 || e.getKey()==13)
{
Ext.getCmp('ename_row').focus(true,true);
}
}
function product_add_sku_no(field){ //当焦点移开时,保存数据
gridRowEditing.grid.editingPlugin.completeEdit();
Ext.Ajax.request(
{
url :'./data/node_tbl_product_info.php?t=11',
method :"post",
params :
{
cpid: product_grid_row[0].get("cpid"),
sku_no : field.getValue()
},
success : function(d)
{
obj = Ext.JSON.decode(d.responseText);
if(obj.success == false)
{
alert(obj.message);
}
}
});
}
var gridRowEditing = Ext.create('Ext.grid.plugin.RowEditing',{//单元格编辑插件 CellEditing 单行编辑插件 RowEditing
clicksToEdit:1//点击一次编辑
});
var sm = Ext.create('Ext.selection.CheckboxModel');
var product_info_grid = Ext.createWidget('gridpanel', {
title:'合同产品信息表',
style:"text-align:center;",
store:product_info_grid_store,
selModel: sm,
width: 980,
height:535,
loadMask: true,
stripeRows: true,
frame:true,
stripeRows: true,
frame:true,
plugins:[gridRowEditing], //调用编辑插件
features:[{
ftype:'summary'//ext.grid.feature.Summary表格
}],
columns: [
{
xtype: 'rownumberer',
width: 20,
sortable: false
},
{
text: '产品信息ID',
dataIndex: 'cpid',
flex: 1,
hidden: true,
sortable: false
},
{
text: '合同ID',
width: 70,
dataIndex: 'contract_id',
sortable: false
},
{
text: '产品编号',
dataIndex: 'sku_no',
width: 130,
sortable: false,
editor:{ //编辑模式一定要有editor这个
xtype:'textfield', //文本输入框
enableKeyEvents:true,//监听键盘按钮要有这个
listeners : {//监听
focus : product_row_cost, //聚焦时调用product_row_cost函数
keypress : product_return_sku_no,//按下键盘时监听
blur: product_add_sku_no //焦点离开时调用product_add_sku_no函数
},
id:'sku_no_row',//监听键盘时,聚焦到哪个输入框的ID
allowBlank:false
}
},
{
text: '品牌',
dataIndex: 'ename',
width: 100,
selectOnFocus :true,
editor:{
xtype:'combo',//下拉框
allowBlank:false,
forceSelection: true,
triggerAction : 'all',
editable :false,
enableKeyEvents:true,
listeners : {
focus: product_row_cost,
keypress: product_return_ename,
blur: product_add_ename
},
id:'ename_row',
store : combo_Product_brand_one,
queryMode : 'remote',
emptyText :'请选择...', //提示信息
displayField : 'Name',
valueField : 'Name'
}
},
{
text: '销售小计',
dataIndex: 'price2',
width: 130,
sortable: false,
xtype:'numbercolumn',
format:'¥0.00',
align:'right',
summaryType:'sum',
summaryRenderer:function(value,summaryData,dataIndex)
{
price2_all=value.toFixed(2);
return "<font size='0.9px'>销售总计:¥"+price2_all+"</font>";
}
}],
product_grid_row=product_info_grid.getSelectionModel().getSelection();
}
if(e.getKey()==39 || e.getKey()==13) //当按下键keypress时,监听回车和向右的按钮
{
Ext.getCmp('cname_row').focus(true,true); //会直接进入下一个右侧输入框
}
}
function product_return_cname(field,e){
if(e.getKey()==37){//按下向左的按钮Ext.getCmp('sku_no_row').focus(true,true);
}
else
if(e.getKey()==39 || e.getKey()==13)
{
Ext.getCmp('ename_row').focus(true,true);
}
}
function product_add_sku_no(field){ //当焦点移开时,保存数据
gridRowEditing.grid.editingPlugin.completeEdit();
Ext.Ajax.request(
{
url :'./data/node_tbl_product_info.php?t=11',
method :"post",
params :
{
cpid: product_grid_row[0].get("cpid"),
sku_no : field.getValue()
},
success : function(d)
{
obj = Ext.JSON.decode(d.responseText);
if(obj.success == false)
{
alert(obj.message);
}
}
});
}
var gridRowEditing = Ext.create('Ext.grid.plugin.RowEditing',{//单元格编辑插件 CellEditing 单行编辑插件 RowEditing
clicksToEdit:1//点击一次编辑
});
var sm = Ext.create('Ext.selection.CheckboxModel');
var product_info_grid = Ext.createWidget('gridpanel', {
title:'合同产品信息表',
style:"text-align:center;",
store:product_info_grid_store,
selModel: sm,
width: 980,
height:535,
loadMask: true,
stripeRows: true,
frame:true,
stripeRows: true,
frame:true,
plugins:[gridRowEditing], //调用编辑插件
features:[{
ftype:'summary'//ext.grid.feature.Summary表格
}],
columns: [
{
xtype: 'rownumberer',
width: 20,
sortable: false
},
{
text: '产品信息ID',
dataIndex: 'cpid',
flex: 1,
hidden: true,
sortable: false
},
{
text: '合同ID',
width: 70,
dataIndex: 'contract_id',
sortable: false
},
{
text: '产品编号',
dataIndex: 'sku_no',
width: 130,
sortable: false,
editor:{ //编辑模式一定要有editor这个
xtype:'textfield', //文本输入框
enableKeyEvents:true,//监听键盘按钮要有这个
listeners : {//监听
focus : product_row_cost, //聚焦时调用product_row_cost函数
keypress : product_return_sku_no,//按下键盘时监听
blur: product_add_sku_no //焦点离开时调用product_add_sku_no函数
},
id:'sku_no_row',//监听键盘时,聚焦到哪个输入框的ID
allowBlank:false
}
},
{
text: '品牌',
dataIndex: 'ename',
width: 100,
selectOnFocus :true,
editor:{
xtype:'combo',//下拉框
allowBlank:false,
forceSelection: true,
triggerAction : 'all',
editable :false,
enableKeyEvents:true,
listeners : {
focus: product_row_cost,
keypress: product_return_ename,
blur: product_add_ename
},
id:'ename_row',
store : combo_Product_brand_one,
queryMode : 'remote',
emptyText :'请选择...', //提示信息
displayField : 'Name',
valueField : 'Name'
}
},
{
text: '销售小计',
dataIndex: 'price2',
width: 130,
sortable: false,
xtype:'numbercolumn',
format:'¥0.00',
align:'right',
summaryType:'sum',
summaryRenderer:function(value,summaryData,dataIndex)
{
price2_all=value.toFixed(2);
return "<font size='0.9px'>销售总计:¥"+price2_all+"</font>";
}
}],
- extjs单行编辑RowEditing修改后台部分的东西后前端写法
- extjs单行编辑RowEditing修改后台部分的东西后呈现的效果
- 修改extjs前端到后台.py
- extjs 解决rowEditing不满足allowBlank时,无法save的问题
- ExtJs 前端接受后台的JSON数据的编码问题
- 部分后台服务器端程序写法
- 项目整理--Echarts前端后台的贯通写法
- 关于ExtJs前端编辑工具sencha cmd对样式修改试用详解
- 基于jquery可编辑后台修改的表格
- extjs 之Ext.data.Store变更单行记录值【修改】
- extjs 之Ext.data.Store变更单行记录值【修改】
- 前端常识性的东西
- ext gridpanel plugin rowediting编辑保存
- gridView单行编辑功能的实现
- QTableView单行不允许编辑的方法
- jqgrid 实现基础的单行编辑功能
- 去掉修改后extjs中grid 左上角的红三角
- extjs的EditorGridPanel修改数据后怎样保存到数据库
- oracle程序终于调通了
- java button tooltip的一个小例子
- android + eclipse + 后台静默安装(一看就会)
- 自定义string类
- CodeFirst解决数据迁移问题
- extjs单行编辑RowEditing修改后台部分的东西后前端写法
- java基础之内部类
- 黑马程序员_集合框架
- GIT标签
- 问题七十九:Armstrong数(续)
- generated file: '../../build/vs71/release/lib_json\json_writer.asm': No such file or directory
- java高级工程师--------nosql和关系型数据库的重点知识
- VC 2012 中调用WebBrowser简单的实现过程(图解过程)
- ZOJ 1524 Supermarket