Cms: Allow JS callbacks for Admin Table events

Created on 13 May 2020  路  1Comment  路  Source: craftcms/cms

Add the ability to have JS callbacks for events in Vue admin tables.

  • [x] loaded
  • [x] Pagination
  • [x] On select
  • [x] Loading
  • [x] Data
enhancement extensibility

Most helpful comment

This is part of a PR going into 3.5 #6409


Information going into the README:

| Name | Data | Scenario |
| ------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| onSelect | Array of IDs | When a checkbox or select all is selected or de-selected. |
| onData | Array of objects | On successful load or page change. |
| onLoaded | - | When the table has loaded (regardless of data loading). |
| onLoading | - | When the table is in a loading state. |
| onPagination | Object | When pagination has loaded (also occurs on first load). Object contains pagination information (e.g. current page, total pages etc). |

Example usage:

new Craft.VueAdminTable({
  // ...
  onLoaded: function() { console.log('LOADED!'); },
  onData: function(data) { console.log('Data:', data); }
  // ...
});

>All comments

This is part of a PR going into 3.5 #6409


Information going into the README:

| Name | Data | Scenario |
| ------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| onSelect | Array of IDs | When a checkbox or select all is selected or de-selected. |
| onData | Array of objects | On successful load or page change. |
| onLoaded | - | When the table has loaded (regardless of data loading). |
| onLoading | - | When the table is in a loading state. |
| onPagination | Object | When pagination has loaded (also occurs on first load). Object contains pagination information (e.g. current page, total pages etc). |

Example usage:

new Craft.VueAdminTable({
  // ...
  onLoaded: function() { console.log('LOADED!'); },
  onData: function(data) { console.log('Data:', data); }
  // ...
});
Was this page helpful?
0 / 5 - 0 ratings