Show the variable data

Show the variable data

Tommy_GTommy_G Posts: 3Questions: 1Answers: 0
edited November 2016 in Free community support

Hello, i am new to this.

How can i show the variable fundResults data on the datatables.

The fundsResults gets a result like "fundresult = Array [17]". Each array is an object with two property. Example:
FundName: "Example fund"
IsAvailable: false

So the result i want is two columns one is the name and the second is availability.

My code looks like following:

    $('#searchButton')
        .click(function () {

            var searchInput = $('#searchInput').val();

            $.ajax({
                url: '@Url.Action("FindFunds", "ManageFund")',
                type: 'POST',
                data: { searchInAllFunds: searchInput },

                success: function (data) {

                    var funds = $.parseJSON(data);
                    var fundResult = funds.fundResult;

                    $('#NEWTABLE').DataTable({
                        "data": fundResult,
                        "columns": [{ "data": "FundName" },
                        { "data":"IsAvailable"}],
                        "pageLength": 15,
                        "lengthMenu": [15, 25]
                        }
                    });
                }
            });
        });

This question has an accepted answers - jump to answer

Answers

  • Tommy_GTommy_G Posts: 3Questions: 1Answers: 0

    Because of reasons that code is working now.

  • allanallan Posts: 63,819Questions: 1Answers: 10,517 Site admin
    Answer ✓

    Just checking - are you saying that it is working as you want now?

    Allan

  • Tommy_GTommy_G Posts: 3Questions: 1Answers: 0
    edited November 2016

    Yes, thank you :)

    The code i posted suddenly worked. I don't know why. Maybe because i restarted visual studio.

This discussion has been closed.