Get or set grid title.
When you pass value in the text parameter this value with be in use for the new title of the grid and the method will return grid object.
When you don't pass value in the text parameter, then the method will return the text of the current grid title.
You can use this method in a combination with toolbarTemplate only if the title is wrapped in element with data-role attribute that equals to "title".
Parameters
Name | Type | Description |
---|---|---|
text | {object} | The text of the new grid title. |
Examples
text
<button onclick="grid.title('New Title')" class="gj-button-md">Set New Title</button>
<button onclick="alert(grid.title())" class="gj-button-md">Get Title</button>
<br/><br/>
<table id="grid"></table>
<script>
var grid = $('#grid').grid({
dataSource: '/Players/Get',
title: 'Initial Grid Title',
columns: [ { field: 'ID', width: 56 }, { field: 'Name' }, { field: 'PlaceOfBirth' } ]
});
</script>
html template
<button onclick="grid.title('New Title')" class="gj-button-md">Set New Title</button>
<button onclick="alert(grid.title())" class="gj-button-md">Get Title</button>
<br/><br/>
<table id="grid"></table>
<script>
var grid = $('#grid').grid({
dataSource: '/Players/Get',
toolbarTemplate: '<div data-role="title">Initial Grid Title</div>',
columns: [ { field: 'ID', width: 56 }, { field: 'Name' }, { field: 'PlaceOfBirth' } ]
});
</script>