使用网格,我想复制一个选定的行。
然后我想在紧随所选行之后的网格位置插入行的副本。
FIDDLE:https://fiddle.sencha.com/#fiddle/1hc6
select count(products.id) as aggregate from `products` as Products
INNER JOIN `agents` as Agent ON (Agent.id = Products.agent_id )
INNER JOIN productlocations as ProductLocations ON (ProductLocations.product_id = Products.id AND Agent .town_id = 674)
INNER JOIN productagents as ProductAgents ON (ProductAgents.product_id = Products.id AND ProductAgents.product_status_id = "your input status Id")
我喜欢用解决方案
答案 0 :(得分:4)
这取决于变量命名。您的名为record
的变量实际上是副本。因此,当您针对商店搜索记录时,您的行索引变量返回索引-1,因此在最后插入(可能是商店API的默认行为)。
以下更改将获得您想要的内容:
var record = grid.getSelectionModel().getSelection()[0];
var copy = record.copy(null);
...
var row = store.indexOf(record); // this used to be -1
store.insert(row, copy);