Assign multiple rendering scripts to a draggable component
Hey CQers ,
I would like to know the best approach to have the same content displayed in a different ways in a portion of a web page for the draggable component which sits on a page component .
To elloborate , I have defined a custom component named 'ProductsList' which by default has default jsp 'ProductsList.jsp'
The business logic for this component is to fetch all the products from JCR . The display logic is that if the component is dragged and dropped on a parsys on a products page which is backed by a template and page components ( to include standard headers , navigations , side bars along with other custom components ) , the list of products should be displayed in a grid view .
If the 'ProductsList' component is dragged and dropped on a 'Suppliers' page which is also backed by same template and page components , the portion of the webpage should display the products in a list view (the page can be refreshed).
One way to achieve is to manipulate the display logic in Productslist.jsp to display either grid view or list view but i'm pretty sure that it wouldn't be the best way .
I'm assuming the best way might be to define two scripts at , 'productslist.jsp' and 'productslist.grid.jsp' and have them resolved using sling by 'extns' and 'selectors" , but i'm not sure where to add those selectors and get them resolved using sling . Thanks in advance for giving any pointers on this .
cheers