Ext.onReady(function() {
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [ 'name', 'class', 'view', 'edit', 'delete']
});
var userStore = Ext.create('Ext.data.Store', {
model: 'User',
data: [
{ name: 'Sri Vidhya', class: '6 A'},
{ name: 'Rafla', class: '9 C'},
{ name: 'Fabin', class: '10 B'},
{ name: 'Jayanthi', class: '8 C'},
{ name: 'Sri Vidhya', class: '6 A'},
{ name: 'Rafla', class: '9 C'},
{ name: 'Fabin', class: '10 B'},
{ name: 'Jayanthi', class: '8 C'},
{ name: 'Sri Vidhya', class: '6 A'},
{ name: 'Rafla', class: '9 C'},
{ name: 'Fabin', class: '10 B'},
{ name: 'Jayanthi', class: '8 C'}
]
});
Ext.create('Ext.grid.Panel', {
cls: 'custom-grid',
renderTo: Ext.getBody(),
store: userStore,
width: 389,
height: 200,
title: 'Student Details',
columns: [
{
text: 'Student Name',
cls: 'studentName',
width: 100,
sortable: true,
hideable: false,
dataIndex: 'name'
},
{
text: 'Student Class',
cls: 'studentClass',
width: 150,
sortable : true,
dataIndex: 'class'
},
{
xtype:'actioncolumn',
width:40,
tdCls:'delete',
items: [{
icon: 'Delete-icon.png', // Use a URL in the icon config
tooltip: 'Delete',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
//**rec.store.remove();**
//rec.store.remove()` is not working.
Suggest me the code that will work here to remove the //entire row?
alert("Delete " + rec.get('name'));
}
}]
},
{
xtype:'actioncolumn',
tdCls:'edit',
width:40,
items: [{
icon: 'edit-icon.png', // Use a URL in the icon config
tooltip: 'Edit',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
alert("Edit " + rec.get('name'));
}
}]
},
{
xtype:'actioncolumn',
tdCls:'view',
width:40,
items: [{
icon: 'view-icon.png', // Use a URL in the icon config
tooltip: 'View',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
alert("View " + rec.get('name'));
}
}]
}
]
});
});
5
A
उत्तर
11
grid.getStore().remove(rec); //or rec.destroy() if the url specified in model
9
1
//My Code Updated with delete options
Ext.onReady(function() {
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [ 'name', 'class', 'view', 'edit', 'delete']
});
var userStore = Ext.create('Ext.data.Store', {
model: 'User',
data: [
{ name: 'Sri Vidhya', class: '6 A'},
{ name: 'Rafla', class: '9 C'},
{ name: 'Fabin', class: '10 B'},
{ name: 'Jayanthi', class: '8 C'},
{ name: 'Sri Vidhya', class: '6 A'},
{ name: 'Rafla', class: '9 C'},
{ name: 'Fabin', class: '10 B'},
{ name: 'Jayanthi', class: '8 C'},
{ name: 'Sri Vidhya', class: '6 A'},
{ name: 'Rafla', class: '9 C'},
{ name: 'Fabin', class: '10 B'},
{ name: 'Jayanthi', class: '8 C'}
]
});
Ext.create('Ext.grid.Panel', {
cls: 'custom-grid',
renderTo: Ext.getBody(),
store: userStore,
width: 389,
height: 200,
title: 'Student Details',
/*selType: 'User',
plugins: [
Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
})
],*/
columns: [
{
text: 'Student Name',
cls: 'studentName',
width: 100,
sortable: true,
hideable: false,
dataIndex: 'name'
/*editor: 'textfield'*/
},
{
text: 'Student Class',
cls: 'studentClass',
width: 150,
sortable : true,
dataIndex: 'class'
/*editor: 'textfield'*/
},
{
xtype:'actioncolumn',
tdCls:'view',
width:40,
items: [{
icon: 'view-icon.png', // Use a URL in the icon config
tooltip: 'View',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
alert("View " + rec.get('name'));
}
}]
},
{
xtype:'actioncolumn',
tdCls:'edit',
width:40,
items: [{
icon: 'edit-icon.png', // Use a URL in the icon config
tooltip: 'Edit',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
alert("Edit " + rec.get('name'));
}
}]
},
{
xtype:'actioncolumn',
width:40,
tdCls:'delete',
items: [{
icon: 'Delete-icon.png', // Use a URL in the icon config
tooltip: 'Delete',
handler: function(grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
//rec.store.remove();
alert("Delete " + rec.get('name'));
grid.getStore().remove(rec);
//grid.getStore().removeAt(rowIndex);
}
}]
}
]
});
});
संबंधित मुद्दे
- 1. jQGrid, ग्रिड के अंदर एक नई पंक्ति कैसे जोड़ें, एक मॉडल के माध्यम से नहीं?
- 2. बिंदु पर पंक्तियों के बीच एक ग्रिड के अंदर एक विभक्त जोड़ने के लिए कोई चाल
- 3. एसक्यूएल में एक पंक्ति के अंदर कई पंक्तियों को कैसे जोड़ना है?
- 4. डुप्लीकेट पंक्तियों से एक पंक्ति का चयन
- 5. एकाधिक पंक्ति पंक्तियों को एक पंक्ति में संयोजित करें MYSQL
- 6. वर्डप्रेस उपयोगकर्ता और usermeta - एक तालिका में एक पंक्ति में एक पंक्ति में एकाधिक पंक्तियों में एक पंक्ति में
- 7. एक स्क्रॉल दर्शक के अंदर एक ग्रिड को जोड़ने के लिए कैसे प्रोग्राम के रूप में
- 8. एक तालिका में एक पंक्ति में किसी अन्य पंक्ति में एक यादृच्छिक पंक्तियों में शामिल हों
- 9. एकाधिक पंक्तियों से एक पंक्ति में
- 10. एक विजेट में एक टॉगल बटन का उपयोग कर?
- 11. क्या मैं एक टीआर क्लिक घटना के अंदर एक बटन क्लिक को बाहर कर सकता हूं?
- 12. एक guid का उपयोग कर परीक्षण ... मैं चर को एक ग्रिड में कैसे सेट करूं?
- 13. ग्रिड व्यू में डिलीट बटन कैसे बनाएं?
- 14. ग्रिड बटन
- 15. एक ही कॉलम मान के साथ mysql पंक्तियों को एक पंक्ति में कैसे समूहित करें?
- 16. जोड़ना स्तंभों और पंक्तियों में एक TableLayoutPanel पंक्ति गतिशील
- 17. आप एक WPF ग्रिड में पंक्ति/कॉलम कैसे डालते हैं?
- 18. मेरी ग्रिड व्यू पंक्तियों से एक वस्तु वापस प्राप्त करना
- 19. रोकें WPF डेटा ग्रिड में एक से अधिक पंक्ति चयन
- 20. पंक्तियों को एक नियम के
- 21. एक मणि के अंदर ActiveRecord मॉडल परीक्षण?
- 22. कैपिबरा: मैं कैसाबारा का उपयोग करके एक पंक्ति में 3 पंक्तियों का परीक्षण कैसे करूं?
- 23. एक परिणाम पंक्ति में एकाधिक पंक्तियों का चयन करें
- 24. एक ग्रिड व्यू में प्रोग्रामेटिक रूप से पंक्ति कैसे डालें?
- 25. सूची के प्रत्येक पंक्ति में एक बटन कैसे जोड़ें?
- 26. चयन बटन के बिना ग्रिड व्यू में पूर्ण पंक्ति का चयन कैसे करें?
- 27. एक विकलांग ग्रिड
- 28. एक बटन के अंदर टेक्स्ट प्राप्त करें
- 29. एक मॉडल segue के साथ एक UIStoryboard में प्रस्तुत एक मॉडल को खारिज कैसे करें?
- 30. रेडियो बटन के 3x3 ग्रिड को कैसे समूहित करें?
संपादन पहली और actioncolumn क्लिक पर दूसरे स्तंभ के लिए कोई सुझाव? – FlashyFuddyFuddy
@ फ्लैशीफड्डीफड्डी जीथ्यूब पर लाइव उदाहरण देखें: http://htmlpreview.github.com/?https://github.com/werdender/ext4examples/blob/master/actioncolumns-edit.html – Vlad
धन्यवाद व्लाद! :) कि वास्तव में बहुत मदद की! – FlashyFuddyFuddy