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
cevap
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);
}
}]
}
]
});
});
İlgili konular
- 1. Tek bir satırdaki değişiklikleri atla
- 2. Bir satırdaki sözlükler dizisini birleştirin
- 3. Bir satırdaki kaydırma çubuğunu gizleme
- 4. Yeni bir satırdaki veriyi bir dosyada yazamıyorum
- 5. Gnuplot, bir satırdan bir satırdaki veriyi çizme
- 6. mysql içinde bir satırdaki belirli sembollerin sayılması
- 7. MS Access SQL: Bir Satırdaki İki Sütundan Veriler İki Satırdaki Bir Sütunda Veriler Olur
- 8. Bash bir satırdaki son satırı al
- 9. MySQL: Bir satırdaki tüm değerleri 2
- 10. Linux'ta belirli bir satırdaki dosyaya metin ekle
- 11. Bir satırdaki NULL değerler sayısını sayın
- 12. Yeni bir satırdaki bir dosyaya nasıl metin eklenir
- 13. Metni belirli bir satırdaki bir TextView'de nasıl alabilirim
- 14. TableLayoutPanel'deki bir satırdaki tüm denetimleri kaldırmanın bir yolu var mı?
- 15. Verigrideki bir satırdaki seçili bir hücreden sınırı kaldır
- 16. Internet Explorer'daki bir satırdaki satırları gezmek, herhangi bir doctype
- 17. Belirli bir satırdaki belirli bir satırın sütun sayısını Java kullanarak kullanarak
- 18. SQL: İlk bulunan satırdaki bir birleştirmeyi nasıl sınırlandırabilirsiniz?
- 19. Önceki satırdaki sütun değerlerini güncelleme
- 20. Bir satırdaki flexbox, left-align ve right-align öğelerini kullanma
- 21. Satırdaki n-inci sembolüne git
- 22. Aynı satırdaki renkli metin TRichEdit
- 23. İlk satırdaki hücrelere stili uygulayın
- 24. DataGridView için, her satırdaki değerleri nasıl alabilirim?
- 25. Satırdaki alana bağlı olarak sorgu nasıl?
- 26. Google Dokümanlar E-Tablosu, bir ölçütle eşleşen satırdaki verileri gösterir
- 27. Python'da bir satırdaki global varlığın üzerine yazılsın mı?
- 28. Excel VBA, Aynı satırdaki bir hücreden değer denetimi
- 29. Girdiler tarafından girilen belirli bir satırdaki verileri al
- 30. Belirli bir satırdaki değerlere göre sütunları yeniden sıralar.
birinci ve actioncolumn tıklandığında ikinci sütununu düzenlemek için herhangi bir öneriniz? – FlashyFuddyFuddy
@FlashyFuddyFuddy Github'daki canlı örneğe bakın: http://htmlpreview.github.com/?https://github.com/werdender/ext4examples/blob/master/actioncolumns-edit.html – Vlad
Teşekkür ederim Vlad! :) Bu gerçekten çok yardımcı oldu! – FlashyFuddyFuddy