title Returns: string or grid object


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

NameTypeDescription
text {object} The text of the new grid title.

Examples

  
Edit this example
<button onclick="grid.title('New Title')">Set New Title</button> <button onclick="alert(grid.title())">Get Title</button> <br/><br/> <table id="grid"></table> <script> var grid = $('#grid').grid({ dataSource: '../Grid/GetPlayers', title: 'Initial Grid Title', columns: [ { field: 'ID' }, { field: 'Name' }, { field: 'PlaceOfBirth' } ] }); </script>
  
Edit this example
<button onclick="grid.title('New Title')">Set New Title</button> <button onclick="alert(grid.title())">Get Title</button> <br/><br/> <table id="grid"></table> <script> var grid = $('#grid').grid({ dataSource: '../Grid/GetPlayers', toolbarTemplate: '<div data-role="title">Initial Grid Title</div>', columns: [ { field: 'ID' }, { field: 'Name' }, { field: 'PlaceOfBirth' } ] }); </script>