Base solution for your next web application
Open Closed

Datatable passing parameters #8040


User avatar
0
Siyeza created

how do I pass this parameter

listAction: { ajaxFunction: _contactsService.getContactsByPolicyHolderId, inputFilter: function () { return { policyHolderId: 2 }; } },

        SEE THE ERROR below
        
        
        ![image.png](/QA/files/fa5fa836dc4ca95dca5e39f190e9ba26.png)

1 Answer(s)
  • User Avatar
    0
    dexmox created

    You could do:

     <a class="example" data-contact-id="2"></a>
    
     listAction: {
                ajaxFunction: _contactsService.getContactsByPolicyHolderId,
                inputFilter: function () {
                    return {
                        id: $(".example").attr("data-contact-id")
                    };
    
                }
            },
    

    The returned data can then be evaluated in the column render function:

    {
                    targets: 0,
                    data: null,                
                    orderable: false,
                    render: function (data) {
                        return data;
                    }
    },