12 Mar 2009 12:09 PM #1
Advanced ListView listeners
In extending Advanced ListView (this - http://extjs.com/examples/view/chooser.html but without being inside a window) I wanted to place a button in the details section to enlarge any the photo shown here.
I've encountered a few issues with how to go about doing this:
A) My picture resizing is done by the servlet, ie if I ask for picture?img=file.jpg&x=200&y=200 it returns file.jpg at 200x200.
In the 'prepareData' section of sorting out my list of ModelData prior to showing I thus add the element 'fullHiRes' which is the link to the pic with the x=200&y=200 bit appended to the string to the ModelData so that it can retrieved in the details later.
Is it best to place multiple entries in the model data IE 'HiRes200x200', 'HiRes400x400', 'HiResFull' when I prepare my data?
If I do this then i'll have to write multiple
publicnative String getDetailTemplate()
methods for each of the different resolution options and switch betweem them based on the users selection though surely?
B] If we don't do this, is there a way to add the relevant single resolution item to only the selected model when its selected? And change the resolution item when something else independently is selected IE an 'enlarge' button?
Presumably this isn't too hard, as I can call the selectionmodel, see whats selected and set/append the link to the picture based on resolution, but would this automatically show in the right hand details section or would I need to refresh this in some way?
Is this the best way to go about things?
Most importantly however:
C) Can you even stick a button inside the details panel or will it be simply deleted whenever
detailTp.overwrite(details.getElement(), Util.getJsObject((ModelData) se.getSelection().get(0)));
Is run (where detailTP is an XTemplate - detailTp = XTemplate.create(getDetailTemplate())