[TYPO3-dev] ExtJS "action buttons" question
Kay Strobach
typo3 at kay-strobach.de
Wed Jul 27 10:39:38 CEST 2011
Hi François,
can you provide a demo extension? - Can't really imagine what you wan't
to do - but for below comment i assume ;)
Perhaps it's enough for you to ask the icon who his parent is?
(dom->parent) and fetch the id from there - otherwise i would use a
grid, this way you can use the selected record directly ;)
Regards
Kay
Am 26.07.2011 17:02, schrieb François Suter:
> Hi all,
>
> I'm working on a TYPO3 BE module with quite a few icons around. Each
> icon is related to a particular table and a particular record (a bit
> like the icons in the Web > List module if you want).
>
> Now rather than having a onclick call on each icon, I'm trying to
> implement this by adding behaviors on the appropriate icons with ExtJS
> (it seems cleaner to me, maybe I'm wrong). My problem is that I need to
> pass the table name and the record's id to the event handling function,
> so that it knows what it should be handling.
>
> Assuming I have something like:
>
> <img src="foo.png" class="action-icon" /> (for table "bar", uid = 1)
> <img src="foo.png" class="action-icon" /> (for table "bar", uid = 2)
> ...
>
> Then I do:
>
> Ext.onReady(function() {
> Ext.addBehaviors({
> 'img.action-icon at click' : TYPO3.MyModule.doSomething
> });
> });
>
> What's the best way for function "TYPO3.MyModule.doSomething" to know
> that the table is "bar" and the uid is 1, 2, or whatever other number?
>
> I thought of the following tricks:
>
> - assemble some id like "bar_1", "bar_2" and extract the information
> from there from within "TYPO3.MyModule.doSomething"
> - add dummy attributes like table="bar" and uid="1", but I guess my HTML
> will not validate anymore then
>
> Is there some clean way to achieve this?
>
> Thanks in advance for any tip.
>
--
http://www.kay-strobach.de - Open Source Rocks
TYPO3 .... inspiring people to share!
Get involved: http://typo3.org
More information about the TYPO3-dev
mailing list