TremulaJS icon indicating copy to clipboard operation
TremulaJS copied to clipboard

Set selected element

Open jpgamaral opened this issue 9 years ago • 3 comments

Hello,

I wanted to be able to trigger a "tremulaItemSelect" and not only listen to that event. Is it possible? I've tried using Grid.getLastSelected() and Grid.getClosestScrollOriginObj() but neither seem to be useful.

Thank you.

jpgamaral avatar Jul 14 '15 19:07 jpgamaral

Can you describe your use-case?

garris avatar Jul 14 '15 19:07 garris

I have a slideshow at the bottom of my page with cars and the selected car's detailed info is presented in the top of the page. On page load I want that the information related to the first car of the slideshow to be presented in the top part.

jpgamaral avatar Jul 15 '15 09:07 jpgamaral

@jpgamaral, sorry for the delay. I think the easiest way to solve this is with something like $('.gridBox').filter(':first').click(). Just call this when you want the first item shown -- it should behave just as if it's been clicked. There are many other ways to do this but I think this answer requires the least knowledge. I hope that helps. Please let me know if this does not solve the problem -- (I didn't test this code)

garris avatar Jul 17 '15 04:07 garris