Grid afterload or afterrefresh event - extjs

I have a function that compares cell values in a grid and if it finds differences, then it changes background color. But all styles dissapper, when the user reloads the grid. I tried to call this function again on grid store load event, but it does nothing, because refresh event happens after load event and clears styles again. If I instead call this function on refresh event, then I get an error. I need something like afterrefresh or afterload event, but can't find them.

Related

Is there the event in Ext.grid.Panel that fires when the data and rows have been reloaded and rendered

The main point of the question: I need the event that fires when the new rows have been rendered and the selection has been restored.
I refresh my grid by calling store.load method. I have a handler for store.load event. It fires when data have been loaded, but before new rows rendering.
I tried afterrender, viewready, selectionchange both in Ext.grid.Panel and Ext.view.Table (the view of the gird), but these events don't fire after every store.load event.
I need this event to work with the restored selection and perform some operations.
instead of calling the load call doRefresh() it will fire beforechange event and change events on the paging toolbar then handle those things in those events do what ever you want todo
you can use:
grid.getView().refresh();
method after store load. It will refresh grid view content.

Invoking a Backgrid from another

I'm in backgrid 1, where I've rowclick event enabled, now I want to invoke a refresh of another grid based on the click.
Two ways I'm thinking a. The row click event handler does the .get and passes the data to the collection of another grid b. Modify the url of the another grid collection , and then call the refresh on that grid.
Any pointers pls?

Set button action in controller

I have a navigation view with one button in the toolbar. Based on the view pushed, the button's label and functionality should chang. I've managed to do this by creating many buttons and activating them as needed (hide/show)
Instead of doing that approach I'd like to have just one button and in the controller change the text and action. Something along these lines:
this.getButton().setHtml("new text");
this.getButton().action = "newaction";
setHtml works, but setting the action doesn't. Examining the button in the console, I see the action changes but when I click it, it responds to the previous action.
Any suggestions on how to approach this?
Thanks
You should use setText instead of setHtml that, err... Doesn't seem to exist! And setHandler to change the handler function.
Alternatively, since you say that you're working in a controller, you can attach a function to the click event of the button and, inside this listener function, decide what action to execute in the current context.

Ext: bind formpanel after datastores for combo's have loaded

In an Ext Js-application I am working on I have a formpanel that contains (among other controls) three comboboxes, each with a different datastore. I need to load the form with existing data and display that in the form. This works for all simpel controls (textboxes, checkboxes) but there is a problem with the comboboxes.
The comboboxes each use a datastore but I can see that there is only one store loaded before the form loads its own data, causing that one combobox to display the correct text and the other two the value. If I click and close the combobox without making a selection the correct text appears.
Is there a way to either delay the loading of the form or the binding of the form until all datastores have loaded? The datastores are local stores with autoload and the formpanel calls its own load in the afterlayout-event.
The problem is that the setValue executed by loading your form is executed before the stores of the combo boxes are actually loaded.
You could try to implement the fix condor and animal of ExtJS have propsed in this forum thread on sencha.com: http://www.sencha.com/forum/showthread.php?75751-OPEN-42-ComboBox-s-setValue-call-with-a-remotely-loaded-Store
It basically just delays the setValue call on any combobox until the store of the combobox is fully loaded.
Load the form panel after the rendering is complete. Is there any specific reason you are loading the form in afterlayout event?
Load the form in afterrender event rather than afterlayout. the afterrender event happens when all form is completely rendered.

combo with search and button-reusable in extjs

i am using a factory function (which has grids within windows called using button handler)within one form.
so when i click the button and open a grid and than close it,it works correctly,
but say for example in a situation:
if i open both grids and close , and than try to open other grid the previous grids contents are loaded,but as i have set the store to load in button handler that particular store is loading correctly(i have checked with fire bug) but contents of grid are not changing
win.hide();//use to hide the window after using it
closeAction: 'hide',//in window config
I am assuming that you are using gridpanels for each of these grids. You could force the stores to reload(). Or on the Window's close or hide event, you could try and clear the data on the store or reset the gridpanel.
You may want to read up on the closeAction property on the Window object. That lets you define the behavior of the close button on the window.

Resources