volosoft / jtable

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

jtable with opened child records #2243

Open vec435 opened 4 years ago

vec435 commented 4 years ago

Can I create jtable with opened child records? Thanks

misterparsons commented 3 years ago

Here is the approach I've taken to do this in the past. Following the paradigm of including a clickable item on the row to open a child table, I give that clickable item a class name say .openChildTable

Then I add a recordsLoaded callback.

    recordsLoaded: function (event, data) {
        var foundRow = $(this).jtable('getRowByKey',targetRowKey);
        if (foundRow) foundRow.find(".openChildTable").trigger('click');
    }

targetRowKey needs to be defined before the table is loaded, and if the row in on the page, jquery delivers a click on the child table element rather than the user.

vec435 commented 3 years ago

Thank you for answer!

 

Четверг, 25 марта 2021, 11:25 +03:00 от Malcolm Parsons @.***>:     Here is the approach I've taken to do this in the past. Following the paradigm of including a clickable item on the row to open a child table, I give that clickable item a class name say .openChildTable Then I add a recordsLoaded callback. recordsLoaded: function (event, data) { var foundRow = $(this).jtable('getRowByKey',targetRowKey); if (foundRow) foundRow.find(".openChildTable").trigger('click'); }

targetRowKey needs to be defined before the table is loaded, and if the row in on the page, jquery delivers a click on the child table element rather than the user. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or unsubscribe .    

владимир чаклин