Top Interview Questions & Answers | Learn Now

Ext JS Interview Questions | Basic and Advanced Level

Written by Venkatesan M | May 17, 2017 10:11:26 AM

Q1. Why we need javascript Library?

Ans: Javascript is an awesome language. It’s super flexible.Browsers are the modern UI paradigm.
The javascript Libraries now must provide a rich set of UI Widgets.
javascript libraries:

  • JQuery
  •  Qooxdoo
  •  Dojo
  • Prototype.js
  • mootools
  • extjs

Q2. Why did you choose Ext JS?

Ans: The overall design of extjs is exemplary.One can learn a lot from it’s unified architecture – no matter which language one is programming in.
Extjs requires you to start with one of their base classes – ensuring a consitent model. Consistency is extremely important for the library to be reusable.

  • Extjs documentation seems to be very comprehensive and well maintained.
  • Key aspect of the EXTJS Library is the cross-browser support.
  • Build rich Internet applications with Ext JS.
  • Ext JS framework is the multitude of rich UI elements provided. These elements include forms, dialog boxes, tabs, trees, and grids.
  • The Ext JS framework includes support for Ajax implementations.
  • Ext JS integration with other Web server frameworks.
  • Ext JS framework development into several popular integrated development environments (IDEs), including Eclipse, Aptana, and Komodo.
  • Ext JS provides excellent performance. The framework is fully object oriented and extensible. Because it's written in the JavaScript language.

Q3. What are major Web browsers supported by Ext JS framework?

Ans:

  • Windows® Internet Explorer® version 6 and later.
  • Mozilla Firefox version 1.5 and later (PC and Macintosh).
  •  Apple Safari version 2 and later.
  •  Opera version 9 and later (PC and Mac).

Q4. Integration of Web development server-side frameworks with Ext JS?

Ans: You can use Ext JS with other common Web development server-side frameworks, including PHP, the Java™ language, Microsoft® .NET, Ruby on Rails, and ColdFusion.

Q5. Where Extjs extended from?

Ans: Ext JS as a project to extend the functionality that the YUI Library.A key aspect of the YUI Library is the cross-browser support.The Extjs framework is fully object oriented and extensible. Because it's written in the JavaScript language.

Q6. Extjs Ajax implementation?

Ans: A typical Ext JS Ajax implementation: an HTML text field and button element that posts data in the text field to a Web server when the button is clicked.

Q7. Do you have any advice for developers using Ext for the first time?

Ans: Ext 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.

Q8. How to access Dom element using EXTJS?

Ans: The Element API is fundamental to the entire Ext library.
Using traditional Javascript, selecting a DOM node by ID is done like this:

var myDiv = document.getElementById('myDiv');
Using Extjs:
Ext.onReady(function() {
var myDiv = Ext.get('myDiv');
});

Q9. what is the purpose of Element Object in Extjs?

Ans:

  • 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.)

Q10. what is syntax for Extjs Button click event?

Ans: Ext.onReady(function() {
Ext.get('myButton').on('click', function(){
alert("You clicked the button");
});
});

ulating it.

Q11. what is use of Ext.onReady() function?

Ans: Ext.onReady is probably the first method that you’ll use on every page. This method is automatically called once the DOM is fully loaded, guaranteeing that any page elements that you may want to reference will be available when the script runs
syntax:
Ext.onReady(function() {
alert(“Congratulations! You have Ext configured correctly!”);
});

Q12. For example, to show our message when any paragraph in our test page is clicked, what is the extjs code on paragraph click?

Ans: 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);
});

Q13. List out the extjs library files to include in JSP page?

Ans: ext-base.js
ext-all-debug.js or ext-all.js
ext-all.css
base.css or examples.css

Q14. List out the css file required to apply Extjs Theme property?

Ans: xtheme-gray.css
ext-all.css

Q15. What is purpose of MessageBox?

Ans: MessageBox is asynchronous.
MessageBox call, which demonstrates the readable message to user.
MessageBox used for multiple purpose like
Ext.Msg.alert()
Ext.Msg.prompt()
Ext.Msg.show({});
Ext.Msg.wait();

 

Q16. write syntax for MessageBox show() method?

Ans: Ext.MessageBox.show({
title: 'Paragraph Clicked',
msg: 'User clicked on Paragraph',
width:400,
buttons: Ext.MessageBox.OK,
animEl: paragraph
});

Q17. What is method to Update the message box body text for MessageBox?

Ans: updateText( [String text] ) : Ext.MessageBox

Q18. What is a widget?

Ans: A widget is a tiny piece or component of functionality.

Q19. What is parent class for all stores in extjs? How many stores exists?

Ans: Ext.data.Store is parent class for all stores.
A Store object uses its configured implementation of DataProxy to access a data object unless you call loadData directly and pass in your data.
subclasses for Store:
GroupingStore, JsonStore, SimpleStore

Q20. How to handle event for a extjs component?

Ans:

  • Using listeners config object.
    For ex for grid events : listeners: {rowclick: gridRowClickHandler,rowdblclick: gridRowDoubleClickHandler}
  • Using addListener( String eventName, Function handler, [Object scope], [Object options] ) : void
    Appends an event handler to this component
  • 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 ){ ..... });

Q21. How to find no of records in a store?

Ans: Using store.getCount() : Gets the number of cached records.
store.getTotalCount() : Gets the total number of records in the dataset as returned by the server.

Q22. How to handle exception while loading datastore?

Ans: 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();
});

Q23. How to handle updates for store changes?

Ans: Use store.commitChanges()

Q24. What is the purpose of each() in store?

Ans: Calls the specified function for each of the Records in the cache
each( Function fn, [records Object] )

Q25. How to get modified records using store object?

Ans: store.getModifiedRecords() : Gets all records modified since the last commit.

Q26. How to get record using index?

Ans: store.getAt( Number index ) : Get the Record at the specified index.

Q27. How to get record using id?

Ans: store.getById( String id ) : Get the Record with the specified id.

Q28. What is the purpose of load() in store? 

Ans: store.load() : returns boolean
Loads the Record cache from the configured Proxy using the configured Reader.
For remote data sources, loading is asynchronous, and this call will return before the new data has been loaded.
store.load({callback: fnCheckData, scope: this});

Q29. What is purpose of loadData() in store?

Ans: store.loadData( Object data, [Boolean append] ) : void
Loads data from a passed data block and fires the load event.
loadData(storeData,false); False to replace the existing records cache.
loadData(storeData,true) : True to append the new Records rather than replace the existing cache.

Q30. How many types of layout managers exist in extjs? What are they? 

Ans: Layouts fall under this package Ext.layout.*
Types of layouts:


  • Absolute Layout:
    This is a simple layout style that allows you to position items within a container using CSS-style absolute positioning via XY coordinates.
  • Accordion Layout:
    Displays one panel at a time in a stacked layout. No special config properties are required other than the layout.
    All panels added to the container will be converted to accordion panels.
  • AnchorLayout:
    This type of layout is most commonly seen within FormPanels (or any container with a FormLayout) where fields are sized relative to the container without hard-coding their dimensions.
  • BorderLayout:
    Border layouts can be nested with just about any level of complexity that you might need.
    Every border layout must at least have a center region. All other regions are optional.
  • CardLayout (TabPanel):
    The TabPanel component is an excellent example of a sophisticated card layout. Each tab is just a panel managed by the card layout such that only one is visible at a time
  • CardLayout (Wizard):
    You can use a CardLayout to create your own custom wizard-style screen.
  • FitLayout:
    A very simple layout that simply fills the container with a single panel.
  • FormLayout:
    FormLayout has specific logic to deal with form fields, labels, etc.FormLayout in a standard panel,
  • ColumnLayout:
    This is a useful layout style when you need multiple columns that can have varying content height.Any fixed-width column widths are calculated first, then any percentage-width columns specified using the columnWidth config
  • TableLayout:
    Outputs a standard HTML table as the layout container.you want to allow the contents to flow naturally based on standard browser table layout rules.
    data, plus manip

Q31. How we can apply pagination in grid panel?

Ans: 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}});

Q32. what is xtype?

Ans: The xtype will be looked up at render time up to determine what type of child Component like TextField, NumberField etc to create. i,e
xtype = Class
----------------------
button = Ext.Button
textfield = Ext.form.TextField
radio - Ext.form.Radio
grid = Ext.grid.GridPanel
combo = Ext.form.Combobox
toolbar = Ext.Toolbar

Q33. What is vtype?

Ans: The validations provided are basic and intended to be easily customizable and extended.
Few types provided by extjs are as below:

  • emailText : String, The error text to display when the email validation function returns false
  • alphanumText : String, The error text to display when the alphanumeric validation function returns false
  • urlText : String, The error text to display when the url validation function returns false

store.getModifiedRecords(): returns array object

Q34. How to get record object from store?

Ans: var record = grid.getStore().getAt(rowIndex);

Q35. Purpose of Load mask?

Ans: 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();

Q36. Purpose of renderer in grid panel?

Ans: Using config option,
renderer: fnCellColor where fnCellColor is method to apply color to a cell.

Q37. How to get selection model used in a grid panel?

Ans: using grid.getSelectionModel(); method

Q38. How to stop editing a record?

Ans: newRecord.endEdit();

Q39. How to start editing a record?

Ans: newRecord.beginEdit();

Q40. How to commit a record modification?

Ans: newRecord.commit();

Q41. What is use of combo select event function?

Ans: To get the selected value from a combo.using getvalue();
var selectedComboValue = mycombo1.getValue();

Q42. How to get a value of textfield or combo box?

Ans: using getvalue();
var selectedValue = mytextfield.getValue();

Q43. How to apply css on select of combo box?

Ans: using config option as
emptyClass : 'emptycss', where emptycss is a css classname

Q44. What are components required for grid panel?

Ans: store, columnmodel, id, width,height

Q45. How to disable menu option for header in columnModel?

Ans: using menuDisabled: true

Q46. How to hide the column in grid panel?

Ans: using hidden : true

Q47. How to register callbacks to the load and exception events of the JsonStore? 

Ans: 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
},

[...]
}

Q48. extjs decode()?

Ans: var json = Ext.decode(response.responseText);
Ext.Msg.alert('Error', json.error);

Q49. Extjs Vs jQuery:

Ans: 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.

Related Interview Questions...