extjs-store-load - extjs

I have simple grid with a store. When I add a record to a store it reflects on the grid. But on few occasions when toggle between browser tabs.
The store load event seem to fire from then on when I add a record to the store its getting added but it don't seem to reflect on the grid
How do I stop the extjs store load event from firing on its own?

Have you thought about adding the following config option to your store?
autoLoad: false

Related

itemselector + ArrayStore. Set data dynamycally

All.
I found an old post on Sencha forum, mentioning store.loadData as the way to set new info into an array store.
This seems to work for a combobox but not for an itemselector as you can see in this fiddle:
https://fiddle.sencha.com/#view/editor&fiddle/2hu9
What's the right way to do it for an itemselector?
Thanks in advance
This seems to be a bug in itemselector, because the user that created itemselector did not anticipate that data can be brought into a store through other means than a pure load. Only a pure load fires the load event on the store, which itemselector listens to.
If you add the line store.fireEvent('load', store, store.getRange()); to the handler to fire the load event manually after loadData, itemselector starts working. There may be better ways to do this, for instance having itemselector listen to datachanged event instead of load event, but this is a quick workaround.

ExtJS Grid roweditor still dirty after grid save and store reload

I'm using ExtJS 5.1.3, I have a grid which is loaded from a store which has a model. The grid is set to use plugin roweditor, so I edit a cell and give it a new value, at this point the red tick is shown that the cell has been changed.
I have a Save button which when clicked gets the store.getModifiedRecords() and passes these off to a ajax request, upon success of this request a few things happen and the last action I do is to load the grid store again which then populates the grid again with the latest version of the data, this is fine and seems to be working as expected.
As this is a multi page application I also have a check when a user navigates away from this page, this is to catch any unsaved grid changes, so basically I get any form from the page and verify the isDirty() value, this is where I am finding my issue, the roweditor is being returned as dirty, this is because some columns have an editor and ExtJS uses form validation on these fields,
I can't understand why the store loading again has not cleared any dirty fields associated with the grid columns? I've tried a number of things such as clearing the store prior to ajax request along with refreshing the grid view, I've tried committing the store changes prior to doing the ajax request but each time I try navigate away from the page after a grid save I pick up the roweditor as having dirty fields :( any help is greatly appreciated.
EDIT: managed to replicate on a simple fiddle
https://fiddle.sencha.com/#view/editor&fiddle/1rmf
The fiddle is basic, to replicate follow these steps;
edit first row age, change age to 13
click Save (i'm forcing the store to load data which has the change we've made)
click 'Check roweditor is Dirty() value' button to see the value of the roweditor isDirty() function, this will return true
if you look at the button handler, you can drill into forms[0].items.items[2] and see that this field has dirty: true which is why isDirty() is returning true.
SOLUTION
As explained in accepted answer, the roweditor is not affected by the store edit/cancel or load in my case. What I did when clicking on 'Save' was to get the grid, then the editor and it's form and called reset() on this so effectively sync everything again.
grid.editingPlugin.getEditor().form.reset();
you can also get access to plugins via grid.getPlugins() which returns an arrary
updated fiddle to show it working
https://fiddle.sencha.com/#view/editor&fiddle/1rmr
During the editing process grid will eventually call loadRecord on the editor's form. However the editor's form is not cleared upon editing success or canceling. That is why your check for dirtyness returns false.
Grid reloading the data is not destroying the editors. It is an optimisation. Editors are created only once and they are destroyed along with the grid.
I'll try to answer regarding to an experience of mine with an all ExtJS desktop application.
By the way looking quickly over your description, you may have to call the Store.sync() method that refreshes your store.
Looking more deeply, there are many way to make CRUD using ExtJs.
I've been made using the "instance" of store but at certain point I had to change it to static calls like MyApp.store.Model.save() etc. That makes you have only one instance of the store avoiding dirty data.
Here's my project folder if you need
https://github.com/guilhermeribeirodev/grizzlyboilerplate/tree/master/src/main/webapp/js/MyApp

ExtJS4 gridPanel data not showing

I've made this very simple jsfiddle to show you this abnormal behaviour http://jsfiddle.net/mrgamer/GgUkE/2/
In my application i'm using the same methods i've written here, .loadRawData() on the store, cause .loadData() doesn't fire the 'load' event.
I'm filling the store manually cause i've to filter some JSON data, compile it, and then insert to this store.
Anyway the problem doesn't seem to be in the store, since the Grid gets populated, you can click on 2 rows, but the data isn't displayed!
Updated
There was a typo in the dataIndex properties in your columns. Required a capital 'I'
Grid Panel with Store example
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.grid.Panel
Fixed code
http://jsfiddle.net/fw3Vc/1/

How do we clear all the items from the Grid in ExtJS?

I am not looking at clearing all the store items with removeAll(). I have a paginated grid which has multiple pages. I want to clear out everything and before i assign new set of data , it should look afresh ? Does anyone know of any API ?
Regards
ExtJS grids are bound to an Ext.data.Store, all of their data comes from the store. If you want to clear the contents of a grid you'd have to clear the contents of its store.
If your data can be loaded from the same store URL with different parameters then you could try just manually overriding them when you want to load fresh data...
grid.getStore().load({
params: {
newParam: value
}
});
The way to clear grid data(without doing a backend hit) is to clear the associated store data and refresh the grid view.
Lets say transactionsGrid is associated with a store, then we can clear data shown in grid as below:
clear data using : transactionsGrid.store.clearData();
then refresh the grid view as : transactionsGrid.view.refresh();

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.

Resources