My second page is not loading for datatable.Everything showing in first page only.Anyone please help

My second page is not loading for datatable.Everything showing in first page only.Anyone please help

AnaghaBPAnaghaBP Posts: 1Questions: 1Answers: 0
edited July 2019 in Free community support

I have used ajax call.I am new to jquery.These are scripts..Please help

    <script>
   $(document).ready(function() {
       loadFindOpportunity();
   });
   $('#findOpportunity').on('click',function(){
    loadFindOpportunity();
   });
   function loadFindOpportunity(findOpportunityUrl) {
       var partyId = $("#partyId").val();
       var name = $("#name").val();
       var stage = $("#stage").val();
       var currency = $("#currency").val();
       
       var findOpportunityUrl = "getOpportunityDetails?partyId=" + partyId + "&name=" + name + "&stage=" + stage + "&currency=" + currency;
       oTable = $('#findOpportunityTable').DataTable({
           "processing": true,
           "serverSide": true,
           "searching": false,
           "destroy": true,
           "ordering": true,
           "ajax": {
               "url": findOpportunityUrl,
               "type": "POST"
           },
           "Paginate": true,
           "columnDefs": [
                {
                    "orderable": false,
                    "targets": [2]
                },
                {
                    "orderable": false,
                    "targets": [3]
                },
            ],
           "order": [[ 1, "ASC" ]],
           "language": {
               "emptyTable": "No data available in table",
               "info": "Showing _START_ to _END_ of _TOTAL_ entries",
               "infoEmpty": "No entries found",
               "infoFiltered": "(filtered1 from _MAX_ total entries)",
               "lengthMenu": "Show _MENU_ entries",
               "zeroRecords": "No matching records found",
               "oPaginate": {
                   "sNext": "Next",
                   "sPrevious": "Previous"
               }
           },
   
           "pageLength": 10,
           "bAutoWidth": false,
           "stateSave": false,
           "columns": [
               
               {
                   "data": "partyId"
               },
               {
                   "data": "opportunityName"
               },
               {
                   "data": "stageDescription"
               },
               {
                   "data": "amount"
               },
               {
                   "data": "estClosed"
               },
               {
                   "data": "opportunityFor"
               },
               {
                   "data": "responsibleFor"
               },
               {
                   "data": "nextStep"
               }
           ]
       });
   }
</script>

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,146Questions: 1Answers: 2,586

    Hi @AnaghaBP ,

    I can only see one table being initialised. We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.