PDA

View Full Version : Custom hack to a custom UX



PCSpectra
11 Mar 2011, 1:13 PM
I've been using ExtJS for about a year now, while I am comfortable using it's default components and occassional UX I am still very wet behind the ears when it comes to custom control development.

That is all going to change this weekend. :)

I struggled for the last several days trying to get a GridPanel to allow dynamic columns. It's simple, kinda works (haven't tested completely) but is horribly hackish and not reusable. All the Grid code is in a function which returns a reference to the Grid object but the URI for where it gets it's data, etc is all hardcoded.

I would love to turn this into a proper UX. However I am not sure to even start, I suppose extending the GridPanel would be a start.

My most pressing concern however, is how to eliminate the need for initializing the Column model and the JsonStore.

Ideally I'd like to initialize the GridPanel (extended as Spreadsheet) with a single data source in the format of a CSV file (with header column names/width/height possibly provided via first row).

I accept that I will likely have to build the column headers programmatically but how and where would I do this? initComponent?

Would implementing a custom CellStore derived from JsonStore make sense?

Where are all the articles for extending GridPanel for version 3/4? I have Googled and found plenty but all seem really outdated and lost of others having issues.

Any assistance or resources are greatly appreciated.

I think I will start by extending a GridPanel and look at existing UX controls for a skeleton template of sorts. I am really curious as to how best ot deal with returning a data source that contains both the column definitions and resultset data - from the ExtJS perspective.

Cheers,
Alex

mschwartz
11 Mar 2011, 1:18 PM
Definitely extend the grid class.

I have some dynamic grids in one of my applications. It calls Ext.grid.GridPanel.reconfigure() a lot :)

That's a clue. My answer is short, since what you're trying to do isn't ultimately clear to me.

tobiu
11 Mar 2011, 2:39 PM
mschwartz is right, use reconfigure with the same store and the new cm and save your time for important things to do :)


best regards
tobiu