3

I have this dynamic column dataTable, and I want to have one column rowspan=2 and the other column 2 rows:

    <p:column headerText="Chapter Name" style="width:80px" rowspan="2" >
        <p:inputText value="#{bookVar.name}" style="width:80px;" id="name"  />
    </p:column>

    <p:columns id="templateTable" value="#{bookBean.tableColHeaderList}" var="colHeader" columnIndexVar="colIndex"  > 
        <f:facet name="header"> #{colHeader.header}</f:facet>

        <p:row>
                <p:inputText value="#{bookVar.chapterList[colIndex].answer}" style="width:10px;" id="answer" tabindex="1" maxlength="1" onblur="value=value.toUpperCase()" onkeyup="$(this).next().focus();" />
        </p:row>
        <p:row>
                <p:inputText value="#{bookVar.chapterList[colIndex].officialAnswer}" style="width:10px;" id="officialAnswer" tabindex="2" maxlength="1" onblur="value=value.toUpperCase()" onkeyup="$(this).next().focus();" />
        </p:row>
    </p:columns>

The way I did it it is not working. Each dynamic column (with both inputText) is in one TD How can I achieve this?

EDIT: changing the question a little - is it possible in a dataTable with dynamic columns, to have 2 rows for each item?

EDIT2: I have already tried using p:column inside my p:row

Thanks

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
qxlab
  • 1,506
  • 4
  • 20
  • 48
  • Dynamic columns is used when you don't know for sure how many columns you need to render. Is that true in your case ? – Adarsh Nov 21 '13 at 22:37
  • Yes it is my case. The quantity of columns depends on another field. – qxlab Nov 21 '13 at 23:44
  • check the primefaces manual/showcase. they have a few examples for dynamic columns. – Adarsh Nov 21 '13 at 23:46
  • But my code is working... they don't have examples for my special case: each row for the dataTable is actually 2 rows. So I'd like 2 for the dynamic columns, and for the other column just one using rowspan = 2, and what I'm getting is just one for all columns – qxlab Nov 21 '13 at 23:49
  • you need to have a inside your – Madhura Nov 22 '13 at 09:44
  • I have already tried, same thing. – qxlab Nov 22 '13 at 09:53
  • Why not just put a `
    ` between the two inputs instead of using ``?
    – BalusC Nov 22 '13 at 11:30
  • Well, what I really want to do is to get this: `onkeyup="$(this).next().focus();"` working properly. The way it is now, it is going to the next element in the same TD, while I need it to go to the next top element in the next TD. – qxlab Nov 22 '13 at 12:54

0 Answers0