Open Source
InformAI allows AI to access and understand the information in your React components
→ Read moreReadNext creates AI-powered content recommendations for your blog or other content
→ Read moreSometimes you want to override one of the methods in ExtJS that return a configuration object - let's use Ext.direct.RemotingProvider's getCallData as an example, which looks like this:
Our aim is to add an 'authentication_token' property to the returned object. You could provide the full config object again in an override, but usually you're overriding to add, remove or change one or two properties and want to leave the rest unmolested. I used to find myself writing a lot of code with this pattern:
All we're really doing here is adding 1 config item - an authenticity_token, but it takes a lot of setup code to make that happen. Check out Ext.decorate:
This lets us write the same override like this:
Much nicer, we just tell it what we want with no need for unwieldy boilerplate code. This method doesn't actually exist in Ext (though it would be good if something similar did), but you could define it yourself as above to keep such code nice and dry.
If you're interested in further enhancing your understanding of method overriding in ExtJS, check out Ext.override - Monkey Patching Ext JS for insights on safely augmenting existing classes. Additionally, you might find The case for Ext.applyOnly useful, as it discusses managing configuration objects to prevent unintended property overwrites.
A few days back Praveen Ray posted about 'Traits' in Ext JS. What he described is pretty much what
One of the classes that has a lot more prominence in Ext JS 4 is the data Proxy. Proxies are respons
Ext.apply is one of those magic Ext JS methods which copies the essence of one object onto another.