ExtJS’ implementation of a combo box, ComboBox, is one of the more complicated components provided in all of ExtJS. It glues together TriggerField and DataView to allow for quite a few different uses. If you’re using both a nameField and a valueField, upon setValue a call is placed to findRecord to determine if [...]
Another fun usage of XTemplate with an assist from DataView’s prepareData function, let’s wrap each paragraph separated by two newlines in actual paragraph tags instead of using Ext.util.Format’s nl2br function, as BR tags cannot be styled.
var config = {
xtype:’dataview’,
singleSelect:true,
autoScroll:true,
cls:’custom’,
overClass:’x-view-over’,
itemSelector:’div.wrap’,
prepareData:function(recordData, ri, record) [...]
It’s always nice to stumble upon patterns that make code both functional and beautiful at the same time. Among those, of late I have been abusing these patterns when developing ExtJS components.
For example, a pattern from ExtJS itself uses Ext.applyIf to both ensure an object literal exists and then to apply default values unless [...]
Recently, I spent some time playing with Persevere, best summed up by its page:
The Persevere Server is an object storage engine and application server (running on Java/Rhino) that provides persistent data storage of dynamic JSON data in an interactive server side JavaScript environment…
Since it speaks JSON HTTP/REST, it’s an excellent candidate for integration with ExtJS. [...]
ExtJS 3.0 RC1.1 includes some interesting improvements under the hood. First, Ext.Button is now a Component, so the ownerCt property works as you’d expect.
More interestingly, there is now a ref property for Component which is initialized during the render portion of the Component lifecycle. It allows you to inject a back reference into [...]
Once in a while, you pull of something quite spectacular. Loading Acrobat Reader inside an Ext.Window is such a feat. It’s the cleanest solution I could come up with that enables a single Rails action to handle the entire PDF creation process without a redirect, keeping a session, or using a GET request. [...]
Nicholas C. Zakas presents, among other things, an interesting way of scheduling work to be done in batches, so the browser doesn’t become unresponsive for the user.
There’s an ExtJS version by Doug Hendricks from the forums, too, although it’s actually framework agnostic.
By default, ExtJS allows you to specify fields which cannot be blank. However, there is no indication to the user that a field is required. Fortunately, with a little monkey patch, it’s easy to add a required form field indicator:
Ext.apply(Ext.layout.FormLayout.prototype, {
originalRenderItem:Ext.layout.FormLayout.prototype.renderItem,
renderItem:function(c, position, target){
if(c && !c.rendered [...]
It’s not quite as intuitive as you’d expect.
cb.store.removeAll();
// force the reload on trigger
cb.lastQuery = null;
The above assumes you keep your Ext.Form around, even after you close an Ext.Window containing the form. If the form is actually destroyed on close, the default, your Combo will be recreated anew. The above is more useful [...]
Today, I discovered that the CheckboxSelectionModel does not clean up after itself on a store reload. If you previously used the header checkbox that selects all records, if you reload the store for whatever reason — I reconfigure my grid with a new store all the time — the header is left checked.
I found [...]