- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个从 JsonStore 加载的复选框模型网格。
var drop_pick_grid = new Ext.grid.GridPanel({
store : dropPickGridStore,
cm : new Ext.grid.ColumnModel([ selectModel, {
sortable : true,
header : "Drop/Pick Loc",
dataIndex : 'locationName',
width : 170,
renderer : function(value, metaData, record, rowIndex,
colIndex, store) {
var refColor = record.data.tourTypeColor;
//console.log(record);
metaData.attr = 'style="background-color:' + refColor + ';"';
return record.get('locationName');
}
}, {
header : "Town/City",
sortable : true,
dataIndex : 'city',
width : 120
}, {
header : "Address",
sortable : true,
dataIndex : 'addr',
width : 170
}, {
header : "EST.Un/Load Time",
sortable : true,
dataIndex : 'estimatedTime',
width : 100
} ]),
sm : new Ext.grid.CheckboxSelectionModel(),
//width : 570,
//height : 390,
autoHeight : true,
autoWidth : true,
frame : true,
iconCls : 'icon-grid',
renderTo : document.body
});
这是我的 dropPickGridStore:
var dropPickGridStore = new Ext.data.JsonStore({
fields : [ {
name : 'locationCode'
}, {
name : 'locationName'
}, {
name : 'city'
}, {
name : 'addr'
}, {
name : 'estimatedTime'
}, {
name : 'tourTypeColor'
} ],
root : 'dropPickLoc',
idProperty : 'locationCode',
//autoDestroy : true,
autoLoad : true,
proxy : new Ext.data.HttpProxy({
url : "http://" + host + ":" + port + "/" + projectName + "/"
+ "PendingDropPicks"
}),
reader : {
type : 'json',
root : 'dropPickLoc'
//idProperty : 'locationName',
},
});
我的Json数据是这样的。
{'dropPickLoc':[{ 'locationCode' : '10007', 'locationName' : 'Gayan Hardware', 'city' : 'Galle', 'addr' : '121, Wijaya Rd, Galle', 'estimatedTime' : '120', 'tourTypeColor' : 'blue' } , { 'locationCode' : '10004', 'locationName' : 'Kandy Hardware', 'city' : 'Kandy', 'addr' : '11, Kurunagala Road, Kandy', 'estimatedTime' : '40', 'tourTypeColor' : 'blue' } , { 'locationCode' : '10009', 'locationName' : 'Mala Stores', 'city' : 'Colombo', 'addr' : '11B, Thimbirigasyaya, Colombo', 'estimatedTime' : '45', 'tourTypeColor' : 'yellow' } , { 'locationCode' : '10003', 'locationName' : 'Namal Ceramic', 'city' : 'Kurunagala', 'addr' : '12B, Lumbini Udyanaya, Kurinagala', 'estimatedTime' : '45', 'tourTypeColor' : 'yellow' } , { 'locationCode' : '10000', 'locationName' : 'Priya Ceramic', 'city' : 'Nugegoda', 'addr' : '15, Nugegoda', 'estimatedTime' : '40', 'tourTypeColor' : 'yellow' } , { 'locationCode' : '10002', 'locationName' : 'Sam Stores', 'city' : 'Galle', 'addr' : '46A, Galle', 'estimatedTime' : '120', 'tourTypeColor' : 'green' } , { 'locationCode' : '10008', 'locationName' : 'Saman Stores', 'city' : 'Polgahawela', 'addr' : '111, Kurunagala Rd, Kurunagala', 'estimatedTime' : '120', 'tourTypeColor' : 'blue' } , { 'locationCode' : '10006', 'locationName' : 'Sell-X Computors', 'city' : 'Ratnapura', 'addr' : '12, Tiriwanakatiya, Ratnapura', 'estimatedTime' : '120', 'tourTypeColor' : 'green' } , { 'locationCode' : '10001', 'locationName' : 'Super Stores', 'city' : 'Kandy', 'addr' : '16, Kandy Road', 'estimatedTime' : '120', 'tourTypeColor' : 'blue' } , { 'locationCode' : '10005', 'locationName' : 'Wijesingha Hardware', 'city' : 'Galle', 'addr' : '113A, Wackewella Road, Galle', 'estimatedTime' : '120', 'tourTypeColor' : 'green' } ]}
用户可以从此网格中选择项目并将其移动到另一个网格中(单击按钮时)。这是我的第二个网格 Pane ;。
var gps_grid = new Ext.grid.GridPanel({
store : estore,
cm : new Ext.grid.ColumnModel([ selectModel, {
sortable : true,
header : "Drop/Pick Loc",
dataIndex : 'locationName',
width : 170
}, {
header : "GPS",
sortable : true,
dataIndex : 'gps',
width : 100
}, {
header : "EST.Un/Load Time",
sortable : true,
dataIndex : 'estimatedTime',
width : 100
}, {
header : "",
sortable : true,
dataIndex : 'colorCode',
width : 30
} ]),
sm : selectModel,
//width : 435,
//height : 400,
autoHeight : true,
autoWidth : true,
frame : true,
iconCls : 'icon-grid',
renderTo : document.body
});
这是我尝试将选定的项目移动到第二个网格面板。
这是我的按钮的监听器。
listeners: {
click: function(){
if (drop_pick_grid.getSelectionModel().hasSelection()) {
selectedItems = drop_pick_grid.getSelectionModel().getSelections();
console.log(selectedItems);
var myReader = new Ext.data.ArrayReader({}, [{
name: 'locationName',
dataIndex: 'locationName'
}, {
name: 'estimatedTime',
dataIndex: 'estimatedTime'
} ]);
var gpsGridStore = new Ext.data.Store({
data : selectedItems,
reader : myReader,
autoLoad : true
});
console.log(gpsGridStore);
}
}
}
我尝试使用第一个网格面板中选定的项目为第二个网格 (gpsGridStore) 创建一个新商店。我让它在我的 Firebug 控制台中打印。但 gpsGridStore 项目是空的。即locationName和estimatedTime取空值。
data
Object { locationName="", estimatedTime=""}
estimatedTime
""
locationName
""
这是 selectedItems 的控制台输出:
data
Object { locationCode="10000", locationName="Priya Ceramic", city="Nugegoda", more...}
addr
"15, Nugegoda"
city
"Nugegoda"
estimatedTime
"40"
locationCode
"10000"
locationName
"Priya Ceramic"
tourTypeColor
"yellow"
我的代码有什么问题吗?如果有人能好心地解释我的代码中的错误是什么以及如何修复它,我将不胜感激。
非常感谢
最佳答案
不要创建另一个商店,只需从第一个网格的商店中删除选定的记录,并将它们添加到第二个网格的商店中。 View 将根据数据更改自动更新。
按钮监听器的代码应如下所示:
var records = dropPickGrid.selModel.getSelections();
dropPickGrid.getStore().remove(records);
gpsGrid.getStore().add(records);
如果您的第二个网格使用不同的模型(即不同的商店字段),您可以从选择中创建新记录,而不是使用相同的记录。但是,您仍然不应该尝试更改网格的存储。与 records 合作.
对于像您这样的复杂示例,请将所有内容放入运行中 fiddle将有助于从这里获得快速且高质量的答案;)
关于javascript - ExtJs 3.4 : Move selected items from one grid to another on a button click,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21019258/
我带着这么简单的问题来到这里,但找不到它......无论如何,你可以在下面看到代码。这是里面有项目的面板。我想要的是更改名称为“intIP”的文本字段的值,它位于面板内部,位于面板内部。我怎样才能做到
如何在 ExtJS 设计中显示面包屑功能。 我正在使用带边框布局的面板,我想在面板顶部设计面包屑功能 请寄给我一些 sample ..... 提前致谢 最佳答案 我想到了两个解决方案。 使用面板标题
你好 如何在 ExtJS 中设计嵌套网格 请提供一些示例(如何在 ExtJS GridPanel 中使用 RowExpander) 最佳答案 尝试这样的事情: //Create the Row Ex
我有类似的东西 Ext.define('HS.controller.Utility', { statics : { state : 'Oklahoma' } }); 现在我想
我有一列checkcolumn类型来启用切换 bool 值。我希望能够一次为该值切换所有行。理想情况下,我可以在checkcolumn header 中添加一个复选框,并监听更改。那可能吗? 我想指出
在我的 extjs 项目中,我有一些 panel我要展示的toolbar在 mouseEnter事件。这工作正常。但是当我用新的 html 更新面板时,mouseenter事件不起作用。 panel.
如何在 ExtJs Combo 中显示图标和显示字段。extjs 组合是否有任何扩展。请提供一些 sample 。 最佳答案 对于 ExtJS4,将带有 getInnerTpl 方法的 listCon
我有用于网格和柱状图的存储,但值是字符串形式的(服务器端格式化的数量,不能在客户端完成)。由于字符串格式的数量,网格没有被呈现。解决方案可能会使用网格和图表所需的数据类型制作单独的存储。但这是低效的方
我正在一个页面上有一个GridPanel的项目中工作。该面板可以显示任意数量的行,并且我设置了autoHeight属性,这将导致GridPanel扩展以适合行数。我现在想要一个水平滚动条,因为在某些分
我有一个网格,它允许用户通过编辑行来输入数字。我希望数字支持 4 位小数,但它只支持 2 位。我想出了如何显示 4 位小数,但它没有注册超过 2 位小数。 因此,如果用户输入 1000.1111,结果
我这里有以下网格: Ext.define('AM.view.user.List', { extend: 'Ext.grid.Panel', alias: 'widget.userlis
我正在将我的应用程序从ExtJs 3迁移到4版本。 我的formPanel上有几个组合框,以前我用过hiddenName 以及所有的stuff提交valueField而不是displayField。
我在一个面板中创建了多个项目。现在我想以“适合”布局显示此面板。我不想修复该面板的高度和宽度。我知道“适合”布局只允许显示一项。 这里可以使用“适合”布局吗?或者有什么替代方案可以实现这一目标吗? 谢
我需要将数据库值加载到组合框中。我不明白,为什么值没有加载到组合框中。通过 firebug,打印出 console.log 值。这是我的组合框代码, var groups = new Ext.data
这是将筛选器动态添加到gridpanel底部工具栏的正确语法吗? this.Grid.getBottomToolbar().plugins=[filters]; 当我这样做时没有错误。但是,它的行为并
我正在使用ExtJS v4.0。 在客户端和服务器端之间维护日期格式确实令人困惑。 用户需要自己的输入格式,但是服务器通常要求提交为一种标准格式。 它应该是ExtJS中的内置实现,但不是。 我已经阅读
我的问题对你来说很容易,但我负担不起..我从行中获取数据并显示在其他面板的字段中我的目标是编辑这些数据并在网格中显示编辑后的数据,请给我一些建议,我知道它需要 commit() 函数但是.. 我的代码
我是 ExtJS 的新手。我遵循了一个教程,目的是在网格上创建分页。代码很简单,我发现它很可疑......结果,分页工具栏在那里,但在第一次加载时仍然显示所有数据。这是我在 View 文件中的代码:
听说EXTJS是一个独立于浏览器的javascript库。 extjs 如何使自己独立于浏览器?当我打开库类时,我没有看到任何代码: 如果(IE)//这样做;else if (FF)//做其他事情;
我有一个类的实例(例如 Ext.data.Model)myRecord 并且需要调用它的静态方法之一(例如 getFields())。我该怎么做? 最佳答案 您还可以使用 self获取类的属性: my
我是一名优秀的程序员,十分优秀!