jQuery Grid Templates
- Getting Started
- Setting Up ASP.NET Core MVC
- Accessibility
- Chart
- ASP.NET
- Overview
- Getting Started
- Design-time Support
- ItemTypes
- Chart Elements
- Chart Types
- Area Chart
- Bar Chart
- Bubble Chart
- Line Chart
- Pie Chart
- Sparklines
- Donut Chart
- Scatter Chart
- Spline Chart
- SplineArea Chart
- RangeArea Chart
- RangeBar Chart
- RangeSpline Chart
- StepLine Chart
- StepArea Chart
- PolarLine Chart
- PolarArea Chart
- PolarBar Chart
- PolarSpline Chart
- PolarSplineArea Chart
- PolarScatter Chart
- Combining Chart Types
- Data Binding
- Exporting
- Localization
- Selection
- Zooming and Panning
- Appearance and Styling
- Server Side Events
- Client Events
- Supported Browsers
- ASP.NET Core
- ASP.NET MVC
- JAVA Apache Wicket
- API
- allowUTCFormatting
- applyAnimation
- axisX
- axisTickText
- axisType
- categoricalValues
- decimalTicks
- drawColor
- drawWidth
- endOffset
- fixedEnd
- inverseOrder
- max
- min
- minorPlotStripColor
- minorPlotStripDashStyle
- minorPlotStripWidth
- minorTicksColor
- minorTicksHeight
- minorTicksRepeat
- minorTicksWidth
- offset
- plotBands
- plotLines
- plotStripColor
- plotStripDashStyle
- plotStripWidth
- startOffset
- swapLocation
- ticksColor
- ticksHeight
- ticksPlacement
- ticksRepeat
- ticksWidth
- title
- axisY
- axisTickText
- axisType
- decimalTicks
- drawColor
- drawWidth
- endOffset
- fixedEnd
- inverseOrder
- max
- min
- minorPlotStripColor
- minorPlotStripDashStyle
- minorPlotStripWidth
- minorTicksColor
- minorTicksHeight
- minorTicksRepeat
- minorTicksWidth
- offset
- plotBands
- plotLines
- plotStripColor
- plotStripDashStyle
- plotStripWidth
- startOffset
- swapLocation
- ticksColor
- ticksHeight
- ticksPlacement
- ticksRepeat
- ticksWidth
- title
- backgroundColor
- borderColor
- borderRadius
- borderWidth
- chartAreaBackgroundColor
- chartAreaBackgroundImage
- chartAreaBorderColor
- chartAreaBorderWidth
- chartAreaPaddingBottom
- chartAreaPaddingLeft
- chartAreaPaddingRight
- chartAreaPaddingTop
- chartLegend
- dataSeries
- enableAutoFit
- events
- exportOptions
- height
- isInverted
- margin
- primaryHeader
- secondaryHeader
- seriesPalette
- seriesSettings
- area
- bar
- bubble
- donut
- line
- pie
- polararea
- polarbar
- polarline
- polarscatter
- polarspline
- polarsplinearea
- rangearea
- rangebar
- rangesplinearea
- scatter
- spline
- splinearea
- steparea
- stepline
- seriesType
- theme
- tooltipSettings
- width
- zoomMode
- Getting Started
- Events
- How-To
- Methods
- Styling
- Supported Browsers
- ASP.NET
- Barcode
- QR Code
- TagCloud
- TreeMap
- Grid
- ASP.NET
- ASP.NET Core
- ASP.NET MVC
- JAVA Apache Wicket
- JavaScript
- API
- Settings
- altRowTemplate
- altRows
- columnReorder
- columns
- dataSource
- detailCollapseCssClass
- detailCollapseText
- detailExpandCollapse
- detailExpandCssClass
- detailExpandText
- detailTemplate
- editing
- exportOptions
- filtering
- grouping
- height
- maxHeight
- noRecordsTemplate
- noRecordsText
- paging
- resizing
- rowHover
- rowTemplate
- scrolling
- selection
- showHeader
- sorting
- toolbar
- Events
- Properties
- Methods
- addRow
- cancelEditing
- clearSelection
- collapseRow
- dataItem
- deleteRow
- destroy
- editCell
- editRow
- expandRow
- exportCsv
- exportExcel
- exportPdf
- filter
- hideColumn
- insertRow
- isHidden
- isLocked
- lockColumn
- page
- pageSize
- refresh
- reorderColumn
- revertChanges
- saveChanges
- scrollTop
- select
- selectedRowIndices
- showColumn
- sort
- ungroup
- unlockColumn
- Settings
- Getting Started
- Autogenerated Editors
- Binding to Data
- Cancel User Iteraction
- Change Options Dynamically
- Columns
- Custom Editors
- Exporting
- Filtering
- Footer Total Aggregates
- Grouping
- Hierarchy
- Paging
- RTL
- Scrolling
- Selection
- Sorting
- Templates
- Themes
- Validation
- API
- Accordion
- AutoComplete
- Button
- Calendar
- CheckBox
- ColorPicker
- ComboBox
- ContextMenu
- DataSource
- DatePicker
- DateTimePicker
- Draggable
- DropDown
- Droppable
- Editor
- ListBox
- LoadingPanel
- MaskedTextBox
- Menu
- MonthYearPicker
- NumericTextBox
- Pager
- ProgressBar
- RadioButton
- Rating
- RecursiveDataSource
- Slider
- SplitButton
- Splitter
- Switch
- Tabs
- TextBox
- TimePicker
- Timeline
- Tooltip
- TreeView
- Upload
- Window
With the flexible templating mechanism in the ShieldUI grid widget, you can define your own layout for all elements. The following templates are available:
Row template and Alternating row template
You can define a template for each row and alternating row via the rowTemplate and altRowTemplate settings of the grid. It takes an html template which will be added into the each grid row and alternating row:
<script id="rowTemplate" type="text/x-shield-template"> <tr class="row"> </tr> </script> <script id="altRowTemplate" type="text/x-shield-template"> <tr class="alt-row"> </tr> </script> $(document).ready(function () { $("#grid").shieldGrid({ dataSource: { data: gridData }, paging: { pageSize: 12, pageLinksCount: 10 }, rowTemplate: $("#rowTemplate").html(), altRowTemplate: $("#altRowTemplate").html(), columns: [ { title: "Contacts" } ] }); });
A live example is available here: row-templates
Detail templates
In order to show more information about the grid row you can use the detail template which is shown under each row. The detail template can be static as well as expand/collapsible. This is controlled by the detailExpandCollapse property.
<script id="detailTemplate2" type="text/x-shield-template"> <table> <tr class="row"> <td> <img src="images/categories/{Category.CategoryID}.png" alt="{Category.CategoryName}" /> </td> <td> {ProductName} {UnitPrice} {UnitsInStock} {Discontinued} </td> </tr> </table> </script> $("#grid2").shieldGrid({ dataSource: { data: products }, detailTemplate: $("#detailTemplate2").html(), detailExpandText: "+", detailCollapseText: "-", scrolling: true, height: 330, rowHover: false, altRows: false, columns: [ { field: "ProductID", title: "ProductID", width: "330px" }, { field: "['Category']['CategoryName']", title: "CategoryName", format: "{0:c}", width: "330px" }, { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "230px" }, { field: "UnitsInStock", title: "Units In Stock", width: "230px" }, { field: "Discontinued", width: "230px" } ] });
A live example is available here: Detail Tempalte
Column templates
You can define a different tempalte for each column of the grid control. To do that you just need to set columnTemplate option to the html template:
<script id="nameTemplate" type="text/x-shield-template"> <div class="image"> ... </div> </script> $(document).ready(function () { $("#grid").shieldGrid({ dataSource: { data: gridData }, paging: { pageSize: 4, pageLinksCount: 10 }, altRows: false, columns: [ { field: "name", title: "Person", columnTemplate: $("#nameTemplate").html(), width: "217px" }, { field: "company", title: "Company Name" }, { field: "phone", title: "Contact Phone" } ] }); });
A live example is available here: column templates
Column header templates
You can define a different tempalte for each column’s header of the grid control. To do that you just need to set columnTemplate option to the html template:
<script id="template1" type="text/x-shield-template"> <div id="People" class="header"> <span class="icon1"> </span> <span class="text">Person Name</span> </div> </script> $(document).ready(function () { $("#grid").shieldGrid({ dataSource: { data: gridData }, paging: { pageSize: 12, pageLinksCount: 10 }, altRows: false, columns: [ { field: "name", headerTemplate: $("#template").html()}, ] }); });
A live example is available here: column templates