ExtJS Interview Questions and Answers
Experienced / Expert level questions & answers
Ques 1. Do you have any advice for developers using ExtJS for the first time?
ExtJS can be used by Web Application developers who are familiar with HTML but may have little or no experience with JavaScript application development. If you are starting to build a new web application, or you are revamping an existing application, then take your time to understand the basics of the library including.
Ques 2. What is the purpose of Element Object in ExtJS?
- Element wraps most of the DOM methods and properties that you'll need, providing a convenient, unified, cross-browser DOM interface (and you can still get direct access to the underlying DOM node when you need it via Element.dom)
- The Element.get() method provides internal caching, so multiple calls to retrieve the same object are incredibly fast
- The most common actions performed on DOM nodes are built into direct, cross-browser Element methods (add/remove CSS classes, add/remove event handlers, positioning, sizing, animation, drag/drop, etc.)
Ques 3. For example, to show our message when any paragraph in our test page is clicked, what is the ExtJS code on paragraph click?
Ext.onReady(function() {
Ext.select('p').on('click', function() {
alert("You clicked a paragraph");
});
});
or
Ext.onReady(function() {
var paragraphClicked = function() {
alert("You clicked a paragraph");
}
Ext.select('p').on('click', paragraphClicked);
});
Ques 4. How to handle event for a extjs component?
1) Using listeners config object.
For ex for grid events : listeners: {rowclick: gridRowClickHandler,rowdblclick: gridRowDoubleClickHandler}
2) Using addListener( String eventName, Function handler, [Object scope], [Object options] ) : void
Appends an event handler to this component
3) Using on( String eventName, Function handler, [Object scope], [Object options] ) : void
Appends an event handler to this element (shorthand for addListener)
For ex: store.on( "datachanged", function( store ){ ..... });
Ques 5. How to handle exception while loading datastore?
Using loadexception event.
syntax: store.loadexception() : Fires if an exception occurs in the Proxy during loading.
use beforeload : ( Store this, Object options ) : Fires before a request is made for a new data object. If the beforeload handler returns false the load action will be canceled.
syntax:
store.on('loadexception', function(event, options, response, error) {
alert("Handling the error");
event.stopEvent();
});
Ques 6. How we can apply pagination in grid panel?
using Ext.PagingToolbar plugin, we can implement pagination to a grid panel
syntax:
new Ext.PagingToolbar({
pageSize: 25,
store: store,
displayInfo: true,
displayMsg: 'Displaying topics {0} - {1} of {2}',
emptyMsg: "No topics to display",
})
// trigger the data store load
store.load({params:{start:0, limit:25}});
Ques 7. What is the purpose of Load mask?
To apply mask to page level / component level.
restrict user not to access any components in page
var pageProcessBox = new Ext.LoadMask( Ext.getBody(), { msg: 'Loading Employee details.' } );
pageProcessBox.show();
Ques 8. What is purpose of renderer in grid panel?
Using config option,
renderer: fnCellColor where fnCellColor is method to apply color to a cell.
Ques 9. How to get selection model used in a grid panel?
Using grid.getSelectionModel(); method
Ques 10. What is use of combo select event function?
To get the selected value from a combo.using getvalue();
var selectedComboValue = mycombo1.getValue();
Ques 11. How to register callbacks to the load and exception events of the JsonStore?
var grid = new Ext.grid.GridPanel({
store: new Ext.data.JsonStore({
[...]
listeners: {
load: this.onLoadSuccess.crateDelegate(this),
exception: this.onLoadException.createDelegate(this)
}
}),
onLoadSuccess: function () {
// success
},
onLoadException: function () {
// error
},
[...]
}
Ques 12. Why did you choose Ext JS?
Given the wide range of JavaScript libraries available it was important to choose the right one. We needed to choose a library that was consistent in the way that it presents information to the user, but also consistent in the way that you code using the library.
With all Ext components extending the ‘Observable’ class we had the ability to write consistent code in an event-driven manner, much like writing a desktop application, not easily achieved with other libraries. What’s more is that we knew it would work cross-browser, again something not easily achieved that saves countless hours on large projects.
Ques 13. What features could we add to Ext to make building a rich application like PLANet easier in the future?
Once an application gets over a certain size, and customer releases become more frequent, the burden of testing the application starts to take its toll. An Ext supported test suite would save huge amounts of time. The current problem of test suites with Ext is being able to reliably predict the automatic ids that Ext generates for page elements. Test tools are beginning to implement support for CSS selectors to overcome this problem, but few currently exist. Ext could provide better documentation on how to build better test cases with Ext so that more time can be spent on development rather than testing.
Ques 14. Difference between ExtJS and JQuery?
ExtJs and JQuery are kind of apples and oranges. You can compare Ext Core to JQuery, and ExtJs to JQuery UI.
Ext JS is a full-fledged widget library while jQuery (not jQuery UI) and Mootools are JavaScript frameworks that help with DOM manipulation etc.
Whilst jQuery and Mootools help with the general workings of a site.
jQuery UI is a much less rich set of components.
Ext JS seems to be focussed on tables and storing data, plus manipulating it.
Most helpful rated by users:
- Why did you choose Ext JS?
- Why do we need javascript Library?
- What is syntax for Extjs Button click event?
- How to access DOM element using EXTJS?
- Integration of Web development server-side frameworks with Ext JS?