There is another solution to extjs grid replication.
Although extjs is often used in previous projects, it may not be noticed, or it may not be necessary to use this function at all.
When talking to the customer a few days ago, the customer said that he wanted to copy the data in the gird table. At that time, he didn't think much about it. I felt that extjs should support this function, you should configure the following parameters. but after I came back, I checked the extjs api and found that there was no such setting at all. I think back to the previous project, it seems that I have not done this function. so I quickly went to the Internet and found some solutions, but I felt it was troublesome to implement them and didn't try it.
When I think about this problem again today, suddenly an idea is flashing in my mind. I should be able to use the cell editing function of gird to achieve the replication effect. so hurry up and test the results. The Code is as follows:
Ext.create('Ext.data.Store', { storeId:'simpsonsStore', fields:['name', 'email', 'phone'], data:{'items':[ { 'name': 'Lisa', "email":"lisa@simpsons.com", "phone":"555-111-1224" }, { 'name': 'Bart', "email":"bart@simpsons.com", "phone":"555-222-1234" }, { 'name': 'Homer', "email":"home@simpsons.com", "phone":"555-222-1244" }, { 'name': 'Marge', "email":"marge@simpsons.com", "phone":"555-222-1254" } ]}, proxy: { type: 'memory', reader: { type: 'json', root: 'items' } }});Ext.create('Ext.grid.Panel', { title: 'Simpsons', store: Ext.data.StoreManager.lookup('simpsonsStore'), plugins: [ Ext.create('Ext.grid.plugin.CellEditing', { pluginId:'rowEditing', clicksToEdit: 1 }) ], columns: [ { text: 'Name', dataIndex: 'name' , editor:{ xtype: 'displayfield' } }, { text: 'Email', dataIndex: 'email', flex: 1 }, { text: 'Phone', dataIndex: 'phone' } ], height: 200, width: 400, renderTo: Ext.getBody()});
The effect is as follows:
I think the effect is good,
To sum up, it is obvious that the implementation is simple and convenient, and supports extjs of various versions. It is determined that row replication is not supported, and an editor must be written for each column.