Wednesday, October 22, 2008

populating the combo box EXT-GWT

There are only a few samples on ext-gwt. The most recent version being 1.1 released in august. I recently have an issue of populating the combo box before the "down-arrow" in the combo box is clicked. Populating the combo box from the database using cold fusion can be done in the following way
  • Firstly we need to define the ModelType of the data that is being extracted from the CFM file, with the root.
  • Next the JSONReader has to be set to the ModelType which specifies the type of the data that has to be stored in the combo box Store.
  • We then need to set up the HttpProxy for the connection to be established with the database. This proxy contains the requestbuilder which actually builds the request String with a "post" or a "get". The header for the request builder should be set which i am not pretty sure why we are doing it, but if doesnot display the output when it is not set.
  • Then the loader for the combo box has to be set with the proxy which tells about the connections to the database and the JSONReader which talks about the format of the expected text.
  • Finally the store is set with the loader, which is assigned to the combo box.
This is usually the process that is followed not only for the combo box but also for almost widget that gets data from a database. Combo box usually gets the data dynamically i.e, the load of the loader is called only when the "down arrow" of the combo box is clicked. To over ride that and have the data extracted well before the button is clicked then we can just include loader.load(); after setting the store, which will perform the load operation.

No comments: