PDA

View Full Version : Grid with Edit Delete image , needs to hide after click



AtulDawkhare
23 Jan 2012, 4:53 AM
Hi
I have Grid with Row editor. and in the action column I have logic for Edit and Delete the row.

Now my requirement is , when user clicks on Edit image ,

1] image should get hide
2] Row editor should gets enabled.

I am able to achieved this. Here is the code for that


{
xtype: 'actioncolumn',
width: 80,
items:
[
{
icon : 'images/new/icon/edit.png',
handler: function(grid, rowIndex, colIndex)
{
var rec = grid.getStore().getAt(rowIndex);
grid.getStore().getAt(rowIndex).set('closed', 1);
grid.addRowCls(grid.getNode(rowIndex),'line-through');
var rec = Store.getAt(rowIndex);
rowEditing.cancelEdit();
rowEditing.startEdit(rec, 0);},
style:'margin-left:5px',
getClass: function(value,metadata,record)
{
var closed = record.get('closed');
if (closed == 1 )
{
return 'x-hide-display';
}
else
{
return 'x-grid-center-icon';
}
}
},
{
icon : 'images/new/icon/delete.png',
handler: function(grid, rowIndex, colIndex)
{
var rec = Store.getAt(rowIndex);
var idx= Store.indexOf(rec);
delete(parent,idx);
}
}
]
}


Now as the row editor is enabled , user has ONLY 2 options
1] click on update
2] click on cancel

30897

My Queries are

1] In both the case I want to enabled the image for that row. [which I have hide/ disabled]
2] I want to know that is it possible to enabled the row editor only on edit image click, rather than clicking on row?

mitchellsimoens
23 Jan 2012, 12:35 PM
I wonder if you can set clicksToEdit to zero and if that would stop the editor from appearing by tapping on the row.

jay@moduscreate.com
23 Jan 2012, 12:50 PM
the proper way of doing it is listening to the beforeedit event, inspect the column. If it's an action column, then prevent the edit from taking place.

AtulDawkhare
23 Jan 2012, 9:37 PM
Thank you so much for the reply.

It is not working even if I made the clicksToEdit to 0. I guess it will work using the listener, let me try it out

Can you please tell me how can i enabled the image , which I have disabled?

I want to know how can I get Action column when the control is in row editor part.