f1ddd7bdbaa08ed5d0bcd8b46a7372328dd16bb1
[Packages/TYPO3.CMS.git] / typo3 / sysext / form / Resources / Public / JavaScript / Wizard / Ux / Ext.ux.grid.ItemDeleter.js
1 /**
2 */
3 Ext.ns('Ext.ux.grid');
4
5 Ext.ux.grid.ItemDeleter = Ext.extend(Ext.grid.RowSelectionModel, {
6 width: 25,
7 sortable: false,
8 dataIndex: 0, // this is needed, otherwise there will be an error
9
10 menuDisabled: true,
11 fixed: true,
12 id: 'deleter',
13
14 initEvents: function(){
15 Ext.ux.grid.ItemDeleter.superclass.initEvents.call(this);
16 this.grid.on('cellclick', function(grid, rowIndex, columnIndex, e){
17 if(columnIndex==grid.getColumnModel().getIndexById('deleter')) {
18 var record = grid.getStore().getAt(rowIndex);
19 grid.getStore().remove(record);
20 grid.getView().refresh();
21 }
22 });
23 },
24
25 renderer: function(v, p, record, rowIndex){
26 return '<div class="remove">&nbsp;</div>';
27 }
28 });