volosoft / jtable

A JQuery plugin to create AJAX based CRUD tables.
http://www.jtable.org
1.1k stars 505 forks source link

Supply DTO object parameter to ABP AppService from Detail View (ListAction) in jTable ? #2006

Open Shawellaby opened 8 years ago

Shawellaby commented 8 years ago

Trying to request data from within an index.js jTable implementation from an ABP AppService which has a DTO as a parameter. (How do I send an object as a parameter back to AppService method from jTable detail ListAction)

I have a master/detail jTable. The Master view loads fine using the filter on screen when the user types a value. When I click on the Detail button the page requests data from an API in ABP. I pass it a "string" with the filter value. The JSON that comes back from the "Detail" request looks identical to the original "master" results but the Detail will not populate, remaining indefinitely in a state of "loading".

When I change the API call so it does not accept a String but instead a DTO (like the Master API), run through the debugger and fill in the Filter value in the DTO the results come back and everything works.

Why would it matter to the caller if the parameter is passed as a string or a DTO (class) ?

How can I pass a DTO in the detail request like it is done in the master?

Master is done like this:

function getPunches(reload) { if (reload) { $punchesTable.jtable('reload'); } else { $punchesTable.jtable('load', { filter: $('#HourlyBillingTableFilter').val() }); } }

Detail looks like this:

actions: { listAction: { method: _punchesService.getRangedDetailPunches( { Filter: $('#HourlyBillingTableFilter').val(), StartDate: employeeData.record.startDate, EndDate: employeeData.record.endDate } ), recordsField: 'punchDetails' } },

How do I properly request a Detail data set from the listAction passing a Filter via DTO ?

Thanks in advance. Tried with Edge and IE 11. jTable 2.4.0

Running: <?xml version="1.0" encoding="utf-8"?>

Shawellaby commented 8 years ago

Found my answer here: http://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=744

Needed to pass a "method" on the Detail ListAction instead of invoking/executing a method. So, my Details ListAction is now: listAction: { method: _punchesService.getRangedDetailPunches }

and the parameters are passed on the Load event for the Child table:

}, function (data) { //opened handler data.childTable.jtable('load', { Filter: $('#HourlyBillingTableFilter').val(), StartDate: employeeData.record.startDate, EndDate: employeeData.record.endDate, }) });