ExtJS Not Using autoLoad Best Practice

The typical usage pattern in Sencha’s ExtJS for loading data into a visual control such as a grid is to assign a grid to a store, then let the store have autoLoad: true which means that when the store is created, it will automatically be loaded and since it is assigned to a visual control (grid), the grid will be populated.  I don’t like that pattern.  I like to be more in control.  There may be things I want to do before the grid is loaded. So, what I do is in the application launch event I load my store first and in my store itself, I explicitly tell it not to autoLoad by setting autoLoad to false.  Below is an example of the code I’m using at the moment to handle this.  Notice that I cleverly show a load mask … Continue Reading

In Sencha ExtJS how not to Thrash Precious Memory with Popup Forms

Typically, in the callback of a button that opens a popup window, we just create the window, get access to it’s form and then show it.  The code looks something like this: var data = this.getSessionDetailPanel().data, store = this.getSessionsStore(), session = store.getById(data.id), formWindow = Ext.create('widget.sessionform'), form = formWindow.down('form').getForm(); // do stuff... formWindow.show(); Assuming the above code is in a Sencha ExtJS button handler that brings up the form, the problem is that when the form gets close, the form panel gets deleted (destroyed) and the next time you use it, it all has to be created again. A better solution is to add to the form … Continue Reading

How To Properly Dynamically Load a Store With Data in Sencha ExtJS

image.png

Introduction For Silicon Valley Code Camp, I’m busy rewriting the session submission and editor module so that we can very soon begin to accept new session submissions.  For those that had the pleasure of submitting sessions last year, you all know that I did not make your lives very easy.  As Douglas Crockford said to me, “I puzzled my way through it”.  Not a ringing endorsement. My Latest Learning The step I’m working on now is showing the session submitter what session tags are associated with the session they are working on.  I could do this by making a separate query (rest call) to a tags store, or, since I have already pulled in a full session record (from my session rest service) that has the tags in it, I’m … Continue Reading

ExtJS form cancel, Save Changes If Changes Have Been Made

image.png

  It seems like when a user cancels out of form after making changes, the obvious thing that should happen is: If Changes Have Been Made, Prompt User To Save If No Changes Have Been Made Just Exit Pretty simple, but we still have to do it. Without showing all the detail code, consider the code below which runs in the Sencha ExtJS MVC controller that gets executed when the user presses cancel on a running form like the following:   The JavaScript Code is as follows: onCancelbuttonsessionitemidClick: function(button, e, eOpts) { var form = button.up('form').getForm(), formWindow = button.up('window'), session = form.getRecord(), store = this.getSessionsStore(); … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: