Tuesday, February 10, 2009

Repeaters

Repeater are the perfect component to use, when you are not sure of the amount of data you are dealing with, for example number of phone numbers provided by the user

in this case you can use Repeaters to iterate thru the customer array and create the component for each
you can use Repeaters to iterate thru the dataprovider and create a seperate component for product






]]>


Now consider the following, you can a module which requires the user to this contact details, and by default only 1 field is provided, to add more you have provided a button and teh user can click the button to add another field. the click event can have the follwoing code "phoneArray.addItem('Phone Number');", this surely works (provided phoneArray is [Bindable] the only problem is if that user has put in some data in the avaiable fields, that would be lost !

Monday, February 9, 2009

String Comparision

While executing a code i realized it was taking the DataGrid around 5 seconds to show the results of the filteration, the code written was simple, where in a string was provided thru the combobox and the filter used the string to filterout the list.

On investigation I found that the problem was not with the actionscript or Flex component e.g. Datagrid / AdvancedDataGrid but the problem was with String comparision, I am not sure why but out of the 5 secs the entire logic was taking more than 4 sec. to execute the string comparision,

After changing the logic from String to Int it was found to complete teh entire operation in less than 1 sec !!!!

So .... if you are using a string comparision in some loop ... esp with huge database like couple of thousands of rows, Avoid matching the String and use int.