You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
hace 3 años
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ---
  2. layout: page
  3. title: Card Refresh Plugin
  4. ---
  5. The card refresh plugin provides the functionality for loading ajax content into the card.
  6. ##### Usage
  7. This plugin can be activated as a jQuery plugin or using the data API.
  8. ###### Data API
  9. {: .text-bold }
  10. Activate the plugin by adding a button with `data-card-widget="card-refresh"` to the card and provide the
  11. required `data-source="/URL-TO-CONTENT"` option. By doing that, the plugin will automatically create a GET request to
  12. the provided URL and render the returned response the `.card-body` section of the card. If you need to process the
  13. returned response before rendering, you should use the jQuery API, which provides hooks to deal with the response.
  14. ###### jQuery
  15. {: .text-bold }
  16. The jQuery API provides more customizable options that allows the developer to pre-process the request before rendering
  17. and post-process it after rendering.
  18. ```js
  19. ("#my-card").refreshBox(options)
  20. ```
  21. ##### Options
  22. {: .mt-4}
  23. |---
  24. | Name | Type | Default | Description
  25. |-|-|-|-
  26. | source | String | '' | The URL to the source.
  27. | sourceSelector | String | '' | A selector to get return only the content of the selector.
  28. | params | Object | {} | GET query paramaters (example: {search_term: 'layout'}, which renders to
  29. URL/?search_term=layout)
  30. | trigger | String |`[data-card-widget="card-refresh"]` | The CSS selector to the refresh button
  31. | content | String |`.card-body` | The CSS selector to the target where the content should be rendered. This selector
  32. should exist within the card.
  33. | loadInContent | Boolean | TRUE | Whether to automatically render the content.
  34. | loadOnInit | Boolean | TRUE | Init plugin on page load.
  35. | responseType | String | '' | Response type (example: 'json' or 'html')
  36. | overlayTemplate | String | TRUE | The HTML template for the ajax spinner
  37. | onLoadStart | Function | Anonymous Function | Called before the ajax request is made
  38. | onLoadDone | Function | Anonymous Function | Called after the ajax request is made. A `response` parameter is passed
  39. to the function that hold the server response.
  40. {: .table .table-bordered .bg-light}
  41. ##### Events
  42. {: .mt-4}
  43. |---
  44. | Event Type | Description
  45. |-|-
  46. |loaded.lte.cardrefresh | Triggered after a card is refreshed.
  47. |overlay.added.lte.cardrefresh | Triggered after the overlay added to the card.
  48. |overlay.removed.lte.cardrefresh | Triggered after the overlay removed from the card.
  49. {: .table .table-bordered .bg-light}
  50. Example: `$('#my-card [data-card-widget="card-refresh"]').on('loaded.lte.cardrefresh', handleLoadedEvent)`
  51. ##### Methods
  52. {: .mt-4}
  53. |---
  54. | Method | Description
  55. |-|-
  56. |load | Reloads the content and runs the `onLoadStart` and `onLoadDone` hooks
  57. {: .table .table-bordered .bg-light}
  58. Example: `$('#my-card-widget').Widget('toggle')`