Tuesday, July 19, 2011

Working with JavaScript frameworks

Currently working on extjs4 for a project at work. I have to admit that though extjs4 is pretty, the documentation really drives me nuts. I had contemplated dropping down to extjs3 as the tutorials seem to be more common, but in terms of the pretty factor, extjs3 can't compare. Also, the code required to do something similar in extjs 3 vs extjs4 is quite different in some cases. As in less lines of code. I love that sort of thing.


I guess I will try to document the problems I face here, and perhaps later will write a mini tutorial(maybe contribute to the examples in sencha?) We'll see.


Some quirks here:


- When passing my data as json, I had to remove the quotes from the data that I meant as numbers, in particular for my case, float. And how I did that was to force the type in my php code before I spat out the data. Not sure why that behaviour, but this caused me a lot of trouble in my chart. I just couldn't get the points to map correctly until I did that.


-  When using the type 'Time' for my chart, I have to define my fields in the model as
fields: [{name: 'date', type: 'Date'}, {name: 'close',type:'float'}]
vs just 
fields: ['date', 'close']  (This worked for my other models.)


So the above is what I can remember offhand, Will add to it when I have time again.

No comments: