0

enter image description hereWhen I am adding a row dynamically on a click of a button its getting added outside my table. I understand that outputpanel renders as span tag . Do we have any solution to my problem .

SERVICE PART

                </tr>
            </thead>
            <tr class="headerRow">
                <td class="dataCell" >
                    Action
                </td>
                <td class="dataCell" >
                    Product
                </td>
                <td class="dataCell" >
                    <span>Description</span>
                </td>
                <td class="dataCell" >
                    <span>Qty</span>
                </td>
                <td class="dataCell" >
                    <span>Serial</span>
                </td>
                <td class="dataCell" >
                    <span>Batch</span>
                </td>
                <td class="dataCell" >
                    <span>Action</span>
                </td>
                <td class="dataCell" >
                    <span>Stock Location</span>
                </td>
                 <td class="dataCell" >
                    <span>Replenish?</span>
                </td>
            </tr>

            <tr class="dataRow odd">
                <td class="dataCell" colspan="1">
                    <span><apex:selectList id="Action1" value="{!anyWord}" size="1">
                        <apex:selectOption itemValue="Consumed" itemLabel="Consumed"/>
                        <apex:selectOption itemValue="Keep in Trunk" itemLabel="Keep in Trunk"/>
                        <apex:selectOption itemValue="Return" itemLabel="Return"/>
                    </apex:selectList></span>
                </td>
                <td class="dataCell"  width="20%">
                    <span>1503243</span>
                </td>
                <td class="dataCell" >
                    <span>LASER</span>
                </td>
                <td class="dataCell" >
                    <span>1</span>
                </td>
                <td class="dataCell" >
                    <span>X27353</span>
                </td>
                <td class="dataCell" >
                    <span>34</span>
                </td>
                <td class="dataCell" >
                    <span>Installed</span>
                </td>
                <td class="dataCell" >
                    <span>Trunk</span>
                </td>
                 <td class="dataCell" >
                    <span>Yes</span>
                </td>
            </tr>
                            <tr class="dataRow odd">
                <td class="dataCell" colspan="1">
                    <span><apex:selectList id="Action2" value="{!anyWord}" size="1">
                        <apex:selectOption itemValue="Consumed" itemLabel="Consumed"/>
                        <apex:selectOption itemValue="Keep in Trunk" itemLabel="Keep in Trunk"/>
                        <apex:selectOption itemValue="Return" itemLabel="Return"/>
                    </apex:selectList></span>
                </td>
                <td class="dataCell"  width="20%">
                    <span>1503223</span>
                </td>
                <td class="dataCell" >
                    <span>LASER</span>
                </td>
                <td class="dataCell" >
                    <span>2</span>
                </td>
                <td class="dataCell" >
                    <span>X27363</span>
                </td>
                <td class="dataCell" >
                    <span>31</span>
                </td>
                <td class="dataCell" >
                    <span>Not Installed</span>
                </td>
                <td class="dataCell" >
                    <span>Warehouse</span>
                </td>
                 <td class="dataCell" >
                    <span>No</span>
                </td>
            </tr>
            <apex:outputPanel id="addRow" layout="block">
            <apex:repeat value="{!row}" var="con">
            <tr class="dataRow odd">
                <td class="dataCell" colspan="1">
                    <span><apex:selectList value="{!anyWord}" size="1">
                        <apex:selectOption itemValue="Consumed" itemLabel="Consumed"/>
                        <apex:selectOption itemValue="Keep in Trunk" itemLabel="Keep in Trunk"/>
                        <apex:selectOption itemValue="Return" itemLabel="Return"/>
                    </apex:selectList></span>
                </td>
                <td class="dataCell" width="20%">
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                <td class="dataCell" >
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                <td class="dataCell" >
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                <td class="dataCell" >
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                <td class="dataCell" >
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                <td class="dataCell" >
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                <td class="dataCell" >
                    <span><apex:inputText value="{!anyWord}"/></span>
                </td>
                 <td class="dataCell" >
                    <span><input type="checkbox" value="{!anyWord}"/></span>
                </td>
            </tr>
            </apex:repeat>
            </apex:outputPanel>
        </table>  
         <apex:pageblockButtons >

                <apex:commandButton value="Add Parts" action="{!AddRows}" reRender="addRow"/>
                <apex:commandButton value="Add Tools" action="{!AddRows}" reRender="addRow"/>

            </apex:pageblockButtons>
    </apex:pageBlock>
</apex:form>

4
  • you can refer my blog for Insert/Remove rows dynamically in pageblocktable Commented May 3, 2017 at 10:44
  • Hi Rohit, I know by using wrapper class we can acheieve this. But I cant use here any as I ahve to use static data and just have to add the row below my table Commented May 3, 2017 at 10:46
  • tried <apex:outputpanel layout="block"> <- renders as a div ? Commented May 3, 2017 at 10:52
  • Guys ! found It was mistake I had placed my outputpanel inside the table. Now when I place my outputpanel outside the tale it renders properly . thanks for your comments Commented May 3, 2017 at 11:19

1 Answer 1

0

found It was mistake I had placed my outputpanel inside the table. Now when I place my outputpanel outside the tale it renders properly

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.