Base solution for your next web application
Open Closed

Datatable ajax, using object lists coming empty #12410


User avatar
0
otoarenacom created

Hello,
I am trying to modify datatable function by adding parameters to getall() function dto generated by power tools, whatever I tried object array always coming empty, am I missing something?

    var dataTable = _$ot_CompanyMemberProtocolsTable.DataTable({
        paging: true,
        serverSide: true,
        processing: true,
        listAction: {
            ajaxFunction: _ot_CompanyMemberProtocolsService.getAll,
            inputFilter: function () {
                return {

                    lstAllAdded: [{ "Name": "A", Value:1 }, { "Name": "C", Value:3 }],
                    testName: 'dfdsa',
                    test: 3,
                    longtest: 123,
                    longnulltest: 345,
                    tester: ($('input[name=id]').val() == null ? "-1" : $('input[name=id]').val())
                };
            },
        },
        columnDefs: [

public class GetAllOt_CompanyMemberProtocolsInput : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
//OTHER Filer params Here
public string tester { get; set; }
public string CompId { get; set; }

public List<ItemsofList> lstAllAdded { get; set; }
public long longtest { get; set; }
public long? longnulltest { get; set; }
public  string testName { get; set; }
public int? test { get; set; }

}

public class ItemsofList : EntityDto<int>
{

public int Value { get; set; }
public string Name { get; set; }

}image.png


4 Answer(s)
  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @otoarenacom

    In the latest version, when I tried it on the DataTable with the lstAllAdded property you added as a filter, I was able to successfully receive the property in the input parameter of the AppService method. Did you run the 'npm run create-bundles' or 'yarn create-bundles' command to reflect the changes in your JavaScript file in the .min.js file?

    If you have run the command and the problem persists, can you open the Inspect section and share the Payload section of the relevant query from the Network tab with us? The relevant field here should come as you specified in the javascript file.

    As shown in the screenshots below

    Screenshot 2025-03-28 101915.png
    image.png
    image.png

  • User Avatar
    0
    otoarenacom created

    Yes bundles are up to date, run commands again anyway.
    Here is the payload
    image.png

  • User Avatar
    0
    otoarenacom created

    My bad, forgot to change service method to post, it is now working.
    Thanks

  • User Avatar
    0
    oguzhanagir created
    Support Team

    Hi @otoarenacom

    We are glad to hear that your issue has been resolved. Have a great day!