Blog

Quizz: Ajax and the object Store

Oct 09, 2009 | English | By Hazel | No Comments | Leer en Espańol

In this Quizz we will evaluate various aspects about the server requests using Ajax and how ExtJS help us achieve this task, also we will evaluate the component Store. Good luck!

Quizz: Ajax and the object Store
Author: Hazel

Excellent! You got the highest grade:

You had a few questions wrong, but you passed with:

I am sorry, you did not get the minimum grade, your grade is:

Is it possible to create “instances” (another objects) from the component “Ext.Ajax”?

  • Yes, for every request we need to create an instance.
  • No, because is a Singleton
  • Yes, because otherwise you cannot make any request.
  • I don’t know

What is the best way to send parameters to the server using the component “Ext.Ajax”?

  • Adding the parameters to the URL like this: servlet.do?param1=23&param2=10
  • Using the property “params” in the configuration.
  • You cannot send parameters to the server.

What kind of information accepts the “params” property?

  • A JavaScript objects with the parameters that are going to be sent: {param: ‘value’}
  • A String with the parameters: “param=value&param2=10”
  • A function that returns the parameters: function(){ return “param=2&param2=10”;}
  • All of the above.

What are the “http methods” we can use to send requests to the server?

  • GET and POST.
  • Only GET.
  • GET, POST, PUT and DELETE.
  • Only POST.

When is the function configured in the property “success” executed?

  • When the server returns the information correctly with the “status” 200.
  • When an error hasn’t happened in the communication.
  • The function is always executed.

When is the function configured in the property “failure” executed?

  • When the server sends the status 404.
  • When the server returns the status 403.
  • When there was an error 500.
  • When there was an error in the server or in the connection and it doesn’t return the “status” 200.

What is a Store?

  • Is a component that that saves temporarily the information through records, it is also used as cache.
  • Is a database hosted in the server.
  • Is an array where the records are saved when we browse an application.
  • Is a component capable of interpreting any amount of information and display it in the screen.

What is the component the store needs to interpret the information it receives?

  • A “Ext.data.XmlReader” that handles the information correctly.
  • A “Ext.data.Reader” that handles any kind of information.
  • An implementation of the abstract component “Ext.data.DataReader” in the desired format (XmlReader, JsonReader, ArrayReader).
  • Only an “Ext.data.JsonReader”.

To load local information stored in an array into the “store”, what method we use?

  • Store.load()
  • Store.loadData(array)
  • Store.loadArray(array)
  • Store.load(array)

If we need to send additional parameters to the server using a “Store”, how do we do that?

  • Store.load({param1:’value’,param2:’value’});
  • Store.load(“params1=value&param2=value”);
  • Store.load({params:{param1:’value’,param2=’value’}});
  • Store.loadData({params “params1=value&param2=value”});

Given the following code, what is displayed in the Firebug console? (just suppose there’s a valid record for the search criteria given).

var result = store.find(‘name’, ‘crysfel’);
console.debug(result);
  • Displays all the fields from the record found.(lastname, age, etc.).
  • Displays the index where the record is found
  • Displays an array with the records found for this search criteria.
  • Displays the word “crysfel”.

What is the result after executing the following code?

var collection = store.queryBy(function(record,id){
	return record.get('age') >20 && record.get('age')<30;
});
  • The variable "collection" contains the records that are not between 20 and 30.
  • The variable “collection” contains all the records where the property “age” is from 20 to 30.
  • The variable “collection” contains all the records where the property “age” is from 21 to 29.
  • The variable “collection” contains a “true” or “false” depending if the records exist according to the search criteria.

Leave a Reply







Updates

RSS

Subscribe to our feeds to receive updates of our newest posts and free tutorials.

Site search

Maybe we have what you need, would you like to search first?

Donations

Would you buy me a cup of coffee? I am sharing my knowledge and time with you, help this project grow. Thank you!