EXTJS 4.2 资料 控件之Grid 行编辑绑定下拉框,并点一次触发一次事件
2015-04-16 09:24
531 查看
主要代码:
详细代码:
{ header: '属性值', dataIndex: 'PropertyValueName', width: 130, editor: new Ext.form.field.ComboBox({ typeAhead: true, triggerAction: 'all', name:'PropertyValueName', store: comboData_DynaPropertyValue, valueField: "PropertyValueName", displayField: "PropertyValueName", mode: 'remote',//local editable: false, triggerAction: 'all', autoload: true, listeners: { "expand": function (combo, store, index) { var selectedData = grid_DynaProperty.getSelectionModel().getSelection()[0].data; comboData_DynaPropertyValue.load({ params: { PropertyId: selectedData.PropertyId, //获取当前选择行的字段ID start: startDynaProperty, limit: limitDynaProperty } }); } } }) }
详细代码:
var startDynaProperty = 0; var limitDynaProperty = 30; Ext.define('DynaProperty', { extend: 'Ext.data.Model', fields: [ { name: "PropertyId", type: "int" }, { name: "PropertyName", type: "string" }, { name: "PropertyEngName", type: "string" }, { name: "PropertyValueId", type: "string" }, { name: "PropertyValueName", type: "float" } ] }); var store_DynaProperty = Ext.create('Ext.data.Store', { model: 'DynaProperty',//这个地方DynaProperty不是一个对象,而是一个类 remoteSort: false, remoteFilter: true, pageSize: limitDynaProperty, //页容量20条数据 method: 'POST', proxy: {//代理 type: 'ajax', url: "/UI/HttpHandlerData/GalleryManagement/GalleryManagement.ashx?operation=SearchPicList",//请求 extraParams: { start: startDynaProperty, limit: limitDynaProperty }, reader: { type: 'json', root: 'Table', //根节点 totalProperty: 'result' //数据总条数 } }, sorters: [{ //排序字段。 property: 'PropertyId', //排序类型,默认为 ASC direction: 'ASC' }], autoLoad: true //即时加载数据 }); var rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { clicksToMoveEditor: 1, autoCancel: false }); var comboData_DynaPropertyValue = Ext.create('Ext.data.Store', { fields: ['PropertyValueId', 'PropertyValueName'], autoLoad: true, proxy: { type: "ajax", url: '/UI/HttpHandlerData/TrademarkCar/TrademarkCar.ashx?operation=Search', reader: { type: "json", root: "Table" } } }); var grid_DynaProperty = Ext.create('Ext.grid.Panel', { store: store_DynaProperty, autoWidth: true, aotuHeight: true, animCollapse: false, enableColumnMove: false, enableHdMenu: false, loadMask: true, loadMask: { msg: '正在载入数据,请稍候...' }, viewConfig: { forceFit: true, stripeRows: true }, forceFit: true, //列表宽度自适应 stripeRows: true,//斑马线 autoSizeColumns: true, //根据每一列内容的宽度自适应列的大小 trackMouseOver: true, //鼠标移动时高亮显示 selModel: { selType: 'checkboxmodel' }, //选择框 scroll: true, plugins: [rowEditing], columns: [ { header: '序号', xtype: 'rownumberer', align: 'left', width: 50 }, { header: '属性', dataIndex: 'PropertyName', width: 200 }, { header: '填值方式', dataIndex: 'ValueMethod', width: 200 },{ header: '属性值', dataIndex: 'PropertyValueName', width: 200 }, { header: '属性值', dataIndex: 'PropertyValueName', width: 130, editor: new Ext.form.field.ComboBox({ typeAhead: true, triggerAction: 'all', name:'PropertyValueName', store: comboData_DynaPropertyValue, valueField: "PropertyValueName", displayField: "PropertyValueName", mode: 'remote',//local editable: false, triggerAction: 'all', autoload: true, listeners: { "expand": function (combo, store, index) { var selectedData = grid_DynaProperty.getSelectionModel().getSelection()[0].data; comboData_DynaPropertyValue.load({ params: { PropertyId: selectedData.PropertyId, start: startDynaProperty, limit: limitDynaProperty } }); } } }) } ] });
相关文章推荐
- EXTJS 4.2 资料 控件之Grid Columns 列renderer 绑定事件
- EXTJS 4.2 资料 控件之Grid 添加行,编辑行,删除行
- EXTJS4.2 控件之Grid 行点击事件
- EXTJS 4.2 资料 控件GroupingGrid
- EXTJS 4.2 资料 控件之Grid 那些事
- Extjs 4.2 grid 行选择绑定回车事件
- EXTJS 4.2 资料 控件之Grid 列鼠标悬停提示
- EXTJS 4.2 资料 控件之textfield文本框加事件的用法
- EXTJS4.2 控件之Grid 根据数据源某列数据不同绑定不同的控件setEditor
- EXTJS 4.2 资料 控件之 xtype: "fieldcontainer",追加html
- 在UltraWebGrid单元格中绑定WebNumericEdit或其它可编辑控件
- EXTJS 4.2 资料 控件textfield中fieldLabel去掉冒号,控件label的长度
- EXTJS 4.2 资料 控件之btn设置可否点击
- EXTJS 4.2 资料 控件之checkboxgroup的用法(静态数据)
- 回收编辑DropDownList下拉框 事件触发前 弹出提示
- Extjs Combo控件 下拉选择之后的事件触发
- asp.net C#动态添加创建生成button按钮控件没有触发执行响应click绑定事件处理
- EXTJS 4.2 资料 控件lable定义
- EXTJS4.2 控件之Grid getRowClass 添加行背景色
- BS将form中的控件这只成只能编辑和jquery绑定事件并传递参数