[TYPO3-dev] ExtJS "action buttons" question

François Suter fsu-lists at cobweb.ch
Tue Jul 26 17:02:31 CEST 2011


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.

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch




More information about the TYPO3-dev mailing list