PDA

View Full Version : Detail Grid not clearing on form reset



Tumac
28 Feb 2010, 2:59 PM
I have a form that has a Detail grid in a Master-Detail record with data binding from a lookup grid.

If I choose an item on the lookup grid, it loads header-type info into the form and loads the 1:n detail data into an EditorGrid.

If I press "reset" on my form, the form clears and the Selected item in my lookup grid deselects, bit my Grid is not clearing.

The way I am trying to clear the grid is by sending a query that returns 0 records back to the detail store, in effect clearing it.

Firebug shows the POST returning 0 records, yet the grid is not refreshing even with a store.reload().

Can anyone help me out here, I would think this is pretty straightforward. I am NOT looking for free code, so it would be nice to get a response to a question for once on this forum......



//RESET function
text: 'Reset'
,handler: function(){
po_form.getForm().reset();
poMasterGrid.getSelectionModel().clearSelections();
.....

//CODE to SEND NULL QUERY <--- this is returning 0 rows in my JSON

poMasterGrid.getSelectionModel().on('rowdeselect',
function(sm, rowIndex, record) {
itemStore.reload(
{params: {'poID': 0}}
);
});

//END of Application

BlueCamel
28 Feb 2010, 9:01 PM
Not quite following you fully, but possibly you need to refresh the GridView after making a change.


poMasterGrid.getView().refresh();

Animal
28 Feb 2010, 10:30 PM
Reloading the item store? But why?

Don't you want to remove All records from it?

Tumac
1 Mar 2010, 5:06 AM
I tried removeAll at first but got a ton of errors in Firebug so I went down the path of returning a null query to the store.

Animal
1 Mar 2010, 5:08 AM
So you didn't debug at all. You just gave up?

Errors have meaning.

Tumac
1 Mar 2010, 5:10 AM
I can replicate again to share

Animal
1 Mar 2010, 5:15 AM
Why not fix the errors?

Tumac
1 Mar 2010, 5:38 AM
Before the reset, after the reset and the firebug repsonses after reset. Now I remember why I moved away from removeAll (before beer drinking event)

If you look at the second Firebug, when using removeAll, it posts a "destroy" action back to the php/database. I do not want to remove the records from the database, just clear my view.

Animal
1 Mar 2010, 6:00 AM
Check the param of removeAll

Tumac
1 Mar 2010, 6:02 AM
Didn't send a param. I will try that. But I am afraid I will remove records from DB....cross fingers