主要代码:

 {
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 行编辑绑定下拉框,并点一次触发一次事件的更多相关文章

  1. 自定义SWT控件二之自定义多选下拉框

    2.自定义下拉多选框 package com.view.control.select; import java.util.ArrayList; import java.util.HashMap; im ...

  2. EXTJS 4.2 资料 控件之Grid 那些事

    最近在学习Extjs4.2 ,积累文章,看得不错,再此留年: //表格数据最起码有列.数据.转换原始数据这3项 Ext.onReady(function(){ //定义列 var columns = ...

  3. EXTJS 4.2 资料 控件之Grid 添加行,编辑行,删除行

    //SiteVariableConfigValue类,创立一个模型类 Ext.define("SiteVariableConfigValue", { extend: "E ...

  4. EXTJS 4.2 资料 控件之Grid Columns 列renderer 绑定事件

    columns: [ { header: '序号', xtype: 'rownumberer', align: 'center', width: 100 }, { header: 'CompanyId ...

  5. EXTJS 4.2 资料 控件之Grid 列鼠标悬停提示

    columns: [ { header: }, { header: }, { header: , renderer: function (v, ctx, record) { ctx.tdAttr = ...

  6. C# 如何定义让PropertyGrid控件显示[...]按钮,并且点击后以下拉框形式显示自定义控件编辑属性值

    关于PropertyGrid控件的详细用法请参考文献: 1.C# PropertyGrid控件应用心得 2.C#自定义PropertyGrid属性 首先定义一个要在下拉框显示的控件: using Sy ...

  7. 用MVC的辅助方法自定义了两个控件:“可编辑的下拉框控件”和“文本框日历控件”

    接触MVC也没多长时间,一开始学的时候绝得MVC结构比较清晰.后来入了门具体操作下来感觉MVC控件怎么这么少还不可以像ASP.net form那样拖拽.这样设计界面来,想我种以前没学过JS,Jquer ...

  8. EXTJS 3.0 资料 控件之 html 潜入label用法

    这是在Extjs 中插入html 控件label! html: "<div><label id='howMany'>您共选中了</label><br ...

  9. EXTJS 4.2 资料 控件之combo 联动

    写两个数据源: 1.IM_ST_Module.js { success:true, data:[ { ModuleId: '1', ModuleName: '资讯' } , { ModuleId: ' ...

随机推荐

  1. jboss之mod_cluster集群

    本篇针对的mode_cluster版本是mod_cluster-1.2.6.Final-linux2-x64.tar.gz / mod_cluster-1.2.6.Final-windows-amd6 ...

  2. CF Playing with Paper

    Playing with Paper time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. 通用函数get和set

    这两个函数在画图时很常用,所有对象都有属性来定义它们的特征,正是通过设定这些属性来修正图形显示的方式.尽管许多属性所有的对象都有,但与每一种对象类型(比如坐标轴,线,曲面)相关的属性列表都是独一无二的 ...

  4. JS轮播图

    <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...

  5. Java Concurrency - Phaser, Controlling phase change in concurrent phased tasks

    The Phaser class provides a method that is executed each time the phaser changes the phase. It's the ...

  6. HttpClient(4.3.5) - HTTP Request & HTTP Response

    HTTP Request All HTTP requests have a request line consisting a method name, a request URI and an HT ...

  7. Java Thread UncaughtExceptionHandler

    有没有发生过这样的情况,你写的工作线程莫名其妙的挂了,如果不是被你刚好看到,拿只能抓瞎了,不知道啥原因了,因为异常的时候只会把stack trace打在控制台上,不会记在你想记得错误日志里,头皮都抓破 ...

  8. 控制GridView中字段的长度,规范数据

    前台:   <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridVi ...

  9. asp.net 文件操作小例子(创建文件夹,读,写,删)

      静态生成要在虚拟目录下创建文件夹 来保存生成的页面 那么就要对文件进行操作 一.创建文件夹 using System.IO; string name = "aa"; strin ...

  10. C# @符号的多种使用方法

    1.限定字符串用 @ 符号加在字符串前面表示其中的转义字符“不”被处理.如果我们写一个文件的路径,例如"D:/文本文件"路径下的text.txt文件,不加@符号的话写法如下:str ...