|
| 1 | +--- |
| 2 | +id: CardHeaderItem.template |
| 3 | +type: template |
| 4 | +--- |
| 5 | +--- |
| 6 | +##### shortDescription |
| 7 | +Configures a custom template for the item. |
| 8 | + |
| 9 | +##### return: String | Element | jQuery |
| 10 | +Template name or container. |
| 11 | + |
| 12 | +##### param(itemData): CollectionWidgetItem |
| 13 | +<!-- %param(itemData)% --> |
| 14 | + |
| 15 | +##### param(itemIndex): Number |
| 16 | +<!-- %param(itemIndex)% --> |
| 17 | + |
| 18 | +##### param(itemElement): DxElement |
| 19 | +<!-- %param(itemElement)% --> |
| 20 | + |
| 21 | +--- |
| 22 | +--- |
| 23 | +##### jQuery |
| 24 | + |
| 25 | +This property supports the following values: |
| 26 | + |
| 27 | +- Template container as a jQuery object or DOM Node |
| 28 | +- A function that returns a template container (as a jQuery object or DOM node) |
| 29 | + |
| 30 | +For more information about templates, refer to the following topic: [DevExtreme {Framework} - Custom Templates](/Documentation/Guide/UI_Components/Common/Templates/#Custom_Templates). |
| 31 | + |
| 32 | + <!-- tab: index.js --> |
| 33 | + $("#card-view-container").dxCardView({ |
| 34 | + cardHeader: { |
| 35 | + items: [{ // ... |
| 36 | + template: '<div>Custom Item</div>' |
| 37 | + }], |
| 38 | + }, |
| 39 | + }); |
| 40 | + |
| 41 | +##### Angular |
| 42 | + |
| 43 | +For more information about templates, refer to the following topic: [DevExtreme {Framework} - Custom Templates](/Documentation/Guide/UI_Components/Common/Templates/#Custom_Templates). |
| 44 | + |
| 45 | + <!-- tab: app.component.html --> |
| 46 | + <dx-card-view> |
| 47 | + <dxo-card-view-card-header> |
| 48 | + <dxi-card-view-item> |
| 49 | + <div *dxTemplate> |
| 50 | + <div>Custom Item</div> |
| 51 | + </div> |
| 52 | + </dxi-card-view-item> |
| 53 | + </dxo-card-view-card-header> |
| 54 | + </dx-card-view> |
| 55 | + |
| 56 | +##### Vue |
| 57 | + |
| 58 | +For more information about templates, refer to the following topic: [DevExtreme {Framework} - Custom Templates](/Documentation/Guide/UI_Components/Common/Templates/#Custom_Templates). |
| 59 | + |
| 60 | + <!-- tab: App.vue --> |
| 61 | + <template> |
| 62 | + <DxCardView> |
| 63 | + <DxCardHeader> |
| 64 | + <DxItem> |
| 65 | + <div>Custom Item</div> |
| 66 | + </DxItem> |
| 67 | + </DxCardHeader> |
| 68 | + </DxCardView> |
| 69 | + </template> |
| 70 | + |
| 71 | + <script> |
| 72 | + import { DxCardView, DxCardHeader, DxItem } from 'devextreme-vue/card-view'; |
| 73 | + |
| 74 | + </script> |
| 75 | + |
| 76 | +##### React |
| 77 | + |
| 78 | +[note] Use the React-specific [render](/Documentation/ApiReference/UI_Components/dxCardView/Configuration/cardHeader/items/#render) and [component](/Documentation/ApiReference/UI_Components/dxCardView/Configuration/cardHeader/items/#component) properties instead of **template**. |
| 79 | + |
| 80 | +For more information about templates, refer to the following topic: [DevExtreme {Framework} - Custom Templates](/Documentation/Guide/UI_Components/Common/Templates/#Custom_Templates). |
| 81 | + |
| 82 | + <!-- tab: App.tsx --> |
| 83 | + import { CardView, CardHeader, Item } from 'devextreme-react/card-view'; |
| 84 | + |
| 85 | + fucntion renderCustomItem() { |
| 86 | + return <div>Custom Item</div>; |
| 87 | + } |
| 88 | + |
| 89 | + function App() { |
| 90 | + return ( |
| 91 | + <CardView> |
| 92 | + <CardHeader> |
| 93 | + <Item ... |
| 94 | + render={renderCustomItem} |
| 95 | + /> |
| 96 | + </CardHeader> |
| 97 | + </CardView> |
| 98 | + ); |
| 99 | + } |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +#####See Also##### |
| 104 | +- [Custom Templates](/Documentation/Guide/UI_Components/Common/Templates/#Custom_Templates) |
0 commit comments