Ok, i have found a solution on my own. I think it is not the best, but
it is a solution.
What i have done is follow:
[code]
<tr:inputText id="iStartDate" value="#{todo.start}"
contentStyle="width:110px;padding:2px;" autoSubmit="true">
<tr:convertDateTime pattern="dd.MM.yyyy HH:mm" />
</tr:inputText>
<tr:spacer width="5" height="1" />
<tr:image id="triggerStartDate" source="/img/date.png"
inlineStyle="border:0px;cursor:pointer;"
onmouseover="addCalendar(this.up().previous(1).down().next().identify(),this.identify(),'%H:%M','true');"
/>
[code]
up() next() and so are intepreted by JavaScript Prototype lib.
The JavaScript function add a calendar. After this i can open the
calendar by click on the image. This act and solved what i want to have.
I get the id of subelements in a treeTable.
I think it was better to have a rule to know which id is on which
component in jsp.
Best greetings Michael
Michael Meierhoff schrieb:
Hallo,
first myfaces and his sub projects a grandious projects. I love it. I
use this libarys for my OpenSource Project WebtopProject.
I have a little problem to find out the id of a component inside a
tr:treeTable. The varStatus variable example "row" give me a index
through #{row.index}, but this is only the index of the container item
not the index of the row. The id's which are refer by the component
are not suitable to call it in the jsp file.
I will take a example:
The indexes get by #{row.index}:
Tree------item1(index=0)--------subitem1(index=0)
| |
--item2(index(=1) --subitem2(index=1)
|
--item3(index=2)
The id's inside columns (treeTable has id=tableId):
Tree------item1(id=tableId:0:otherID)--------subitem1(id=tableId:4:otherID)
| |
--item2(id=tableId:1:otherID)
--subitem2(id=tableId:5:otherID)
|
--item3(id=tableId:2:otherID)
and so on.
Why i need this? I need a calendar component. tr:inputDate and
t:inputDate is not suitable for me, because of lack of hour in it and
some functions on. The tr:inputDate always make a whole page refresh
not a partial refresh. Also a Monday can't be the first date of week.
I life in Germany, here begins the week with Monday. What i use is a
free JavaScript LGPL DHTML calendar. This Calendar lib very flexible.
And therfore very suitable for me. This is only one example of
needing. I have also other needs where i want to extend some functions
through own javascript. Most time, when a component is good but let me
not do what i want. To write a own component is a very time expensive
task.
A short extract of the code inside the treeTable:
<tr:inputText id="iDeadlineEdit" value="#{todo.deadline}"
contentStyle="width:110px;padding:2px;">
<tr:convertDateTime pattern="dd.MM.yyyy HH:mm" />
</tr:inputText>
<tr:spacer width="5" height="1" />
<tr:image id="triggerDeadlineDate" source="/img/date.png"
inlineStyle="border:0px;cursor:pointer;" />
<wtp:calendarPopup inputId="ttm:#{row.index}:iDeadlineEdit"
showsTime="true" ifFormat="%H:%M" />
Ok, the last part is facelets. Ther is following code in.
<trh:script>
Calendar.setup({
inputField : '#{inputId}', // id of the input field
button : '#{buttonId}', // trigger for the calendar
(button ID)
ifFormat : '%d.%m.%Y #{ifFormat}', // format of the input field
showsTime : #{showsTime}, // will display a time selector
singleClick : true, // double-click mode
step : 1, // show all years in drop-down
boxes (instead of every other year as default)
firstDay : 1
});
</trh:script>
This does not function because with children the id is not correct. I
have also try to calculate from model, which i can get per varStatus,
but this is not so easy.
#{row.model.depth == 1 ? row.index : ProjectBean.project.todoSize + 1
+ row.model.containerRowKey[1] * row.model.depth + row.index} This is
not correct for whole calculation of id.
Maybe someone have a good typ for me who i can get the correct id.
Otherwise i think i has to calculate the position of the rowData from
my model tree. But this way i don't want to go.
Greetings Michael Meierhoff