2

I tried to generate data table using JSON, everything looks good, the output text is will be created as the value, and the input text is not.

but, when i used apex:selectlist, the selectlist option value will be set in my excel value too,

what should i do to make the value of selectlist option not include in?

I already tried so many ways but still cannot figure it out, do you guys have any idea? thankyou enter image description here

<script>
j$(document).ready( function () {
    j$('[id$="salesPlanTable"]').DataTable({iDisplayLength: 50, searching: false, dom: 'lBfrtip', stateSave: true, order: [], buttons: ['excel']});
});
</script>
<table id="salesPlanTable" class="stripe row-border order-column" style="width:100%"> 
    <thead>
        <tr>
        <th id="columnA">PPD Delivery Schedule</th>
        <th id="columnA2" data-orderable="false">
            <span style="white-space: pre-line"> Check Opex</span>
            <br/><br/>
            <input type="button" id="checkTrue" value="Check All" class="toggle_check_true" onclick="toggleCheckTrue()"/>
            <input type="button" id="checkFalse" style="display:none;" value="Uncheck All" class="toggle_check_false" onclick="toggleCheckFalse()"/> 
        </th>
        <th id="columnB">PPD No.</th>
        </tr>
    </thead>
    <tbody>
        <apex:repeat value="{!dataSalesPlan}" var="i">
            <tr>
            <td id="columnA">
                <apex:input type="date" style="width:90%" id="deliveryschedule" value="{!i.deliverySchedulePPD}"/>
                <apex:outputText styleClass="hidden" value="{0, date, MMMM d','  yyyy}">
                    <apex:param value="{!i.deliverySchedulePPD}" />
                </apex:outputText>
            </td>
            <td id="columnA2">
                 <apex:selectList id="selVal" styleClass="checkOpex {!i.spd.ID}" value="{!i.opex}" size="1">
                   <apex:selectOption itemValue="True" itemLabel="Checked" />
                   <apex:selectOption itemValue="False" itemLabel="Unchecked"/>
                </apex:selectList>
               <apex:outputText styleClass="hidden checkOpexOutput{!i.spd.ID}" value="{0}">
                    <apex:param value="{!i.opex}" />
                </apex:outputText>
            </td>
            <td id="columnB">
                 <apex:outputlink value="/{!i.spd.Prospect__r.Id}">{!i.spd.Prospect__r.Name}</apex:outputlink>
            </td>
            </tr>
        </apex:repeat>
    </tbody>
</table>
2
  • 1
    Put the selectlist in a different td (column) from the outputText and use the Datatables col selector to hide the column with the selectlist in it. Commented Aug 28, 2022 at 19:56
  • 1
    Thanks, i already do it and it workss Commented Aug 29, 2022 at 4:40

1 Answer 1

1

I update my code like this

<apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel">
    <apex:tab label="Validate" name="validate" id="tabValidate">
        <apex:outputPanel id="wrapSalesPlanTable">
            <script>
            j$(document).ready( function () {
                j$('[id$="salesPlanTable"]').DataTable({iDisplayLength: 50, searching: false, dom: 'lBfrtip', stateSave: true, order: [],
                                                        buttons: [
                                                            {
                                                                extend: 'excel',text: 'Excel',
                                                                exportOptions: {columns: [ 0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34]}
                                                            }
                                                        ],select: true
                                                       });
            });
            </script>
            <table id="salesPlanTable" class="stripe row-border order-column" style="width:100%"> 
                <thead>
                    <tr>
                        <th id="columnA">PPD Delivery Schedule</th>
                        <th id="columnA2" data-orderable="false">
                            <span style="white-space: pre-line"> Check Opex</span>
                            <br/><br/>
                            <input type="button" id="checkTrue" value="Check All" class="toggle_check_true" onclick="toggleCheckTrue()"/>
                            <input type="button" id="checkFalse" style="display:none;" value="Uncheck All" class="toggle_check_false" onclick="toggleCheckFalse()"/> 
                        </th>
                        <th style="display: none;">Check Opex</th>
                        </tr>
                </thead>
                <tbody>
                    <apex:repeat value="{!dataSalesPlan}" var="i">
                        <tr>
                            <td id="columnA">
                                <apex:input type="date" style="width:90%" id="deliveryschedule" value="{!i.deliverySchedulePPD}"/>
                                <apex:outputText styleClass="hidden" value="{0, date, MMMM d','  yyyy}">
                                    <apex:param value="{!i.deliverySchedulePPD}" />
                                </apex:outputText>
                            </td>
                            <td id="columnA2">
                                 <apex:selectList id="selVal" styleClass="checkOpex {!i.spd.ID}" value="{!i.opex}" size="1">
                                   <apex:selectOption itemValue="True" itemLabel="Checked" />
                                   <apex:selectOption itemValue="False" itemLabel="Unchecked"/>
                                </apex:selectList>
                            </td>
                            <td style="display: none;">
                            <apex:outputText styleClass="hidden checkOpexOutput{!i.spd.ID}" value="{0}">
                                    <apex:param value="{!i.opex}" />
                                </apex:outputText>
                            </td>
                            </tr>
                    </apex:repeat>
                </tbody>
            </table>
        </apex:outputPanel>
    </apex:tab>
</apex:tabPanel>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .