soma13
26 Mar 2009, 3:32 AM
Hi All,
I use EditorGrid with "add item" and "remove item" button. When user click on add button I add a new model to store of grid with this code:
invoiceItemStore.add( new InvoiceItemModel() );
When user click on remove button I remove current item from model:
InvoiceItemModel selectedItem = grid.getSelectionModel().getSelectedItem();
invoiceItemStore.remove(selectedItem);
It is working very well. After user click on the "save" button, I make an rpc call to persist content of grid to database on server side.
My problem is, that I have not got information about deleted row on server side, because I deleted rows of grid from store and I do not know which rows need to delete from database.
My idea is: when user clicks on the delete button I do not delete current model from store. Instead of I set a delete flag in model. I can implement it, but I do not know how I can hide items from grid where its delete flag is true.
My question is: can I use filter on EditorGrid to show/hide items?
I want to use simmilar code:
Client side
if ( model.getDeleted() )
{
// can not show this item in the grid.
}
Server side:
if ( model.getDeleted() )
{
delete from table …. where id = model.getId()
}
else
{
if (model.getId() == null)
{
insert into….
}
else
{
update…..
}
}
Please help me.
Thank you.
I use EditorGrid with "add item" and "remove item" button. When user click on add button I add a new model to store of grid with this code:
invoiceItemStore.add( new InvoiceItemModel() );
When user click on remove button I remove current item from model:
InvoiceItemModel selectedItem = grid.getSelectionModel().getSelectedItem();
invoiceItemStore.remove(selectedItem);
It is working very well. After user click on the "save" button, I make an rpc call to persist content of grid to database on server side.
My problem is, that I have not got information about deleted row on server side, because I deleted rows of grid from store and I do not know which rows need to delete from database.
My idea is: when user clicks on the delete button I do not delete current model from store. Instead of I set a delete flag in model. I can implement it, but I do not know how I can hide items from grid where its delete flag is true.
My question is: can I use filter on EditorGrid to show/hide items?
I want to use simmilar code:
Client side
if ( model.getDeleted() )
{
// can not show this item in the grid.
}
Server side:
if ( model.getDeleted() )
{
delete from table …. where id = model.getId()
}
else
{
if (model.getId() == null)
{
insert into….
}
else
{
update…..
}
}
Please help me.
Thank you.