BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
var grid = document.getElementById("Grid").ej2_instances[0]; // Grid instance
grid.getCurrentViewRecords();
|
var grid = document.getElementById("Grid").ej2_instances[0]; // Grid instance
grid.pageSettings.totalRecordsCount
|
Dear Prasanna,
Thanks a mil for getting back to regarding my query. To answer your question: I came across totalItemsInfo while analyzing the grid. I had previously added translations to ej.base.L10n.load({'de': { [...], 'totalItemsInfo': [...], that is why I tried to use that.
Thank you also for providing a suggestion about how to access the current records. Unfortunately, I am not quite sure where to put this snippet, since I got an error saying: Uncaught TypeError: Cannot read property '0' of undefined.
I just put your code snippet in a new script section for testing before working with the value retrurned, e.g.
var grid = document.getElementById("Grid").ej2_instances[0]; // Grid instance
grid.getCurrentViewRecords();
Do I need to define a function and access this function from the grid? Thanks a mil in advance for your suggestions.
Kind regards
Chris
Index.cshtml
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
…
}).AllowPaging().Locale("de").Height(500).Width("100%").PageSettings(page=> { page.PageCount(5); }).Render()
<script>
ej.base.L10n.load({
'de': { // in de function give the customization
'pager': { // pager function use to locale the pager components
'currentPageInfo': '{0} von {1} Seiten',
'totalItemsInfo': '({0} Beiträge)',
'firstPageTooltip': 'Zur ersten Seite',
'lastPageTooltip': 'Zur letzten Seite',
'nextPageTooltip': 'Zur nächsten Seite',
'previousPageTooltip': 'Zurück zur letzten Seit',
}
});
</script>
|
Index.cshtml
@Html.EJS().Button("full").Content("Full Grid Records").Render()
@Html.EJS().Button("current").Content("Current Records").Render()
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).Columns(col =>
{
…
}).AllowPaging().PageSettings(page=> { page.PageCount(5); }).Render()
<script>
document.getElementById("full").addEventListener('click', () => {
var grid = document.getElementById("Grid").ej2_instances[0];
var count = grid.pageSettings.totalRecordsCount;
console.log(count);
});
document.getElementById("current").addEventListener('click', () => {
var grid = document.getElementById("Grid").ej2_instances[0];
var num = grid.getCurrentViewRecords();
console.log(num)
});
</script>
|
Index.cshtml
@Html.EJS().Grid("Grid").DataSource((IEnumerable<object>)ViewBag.dataSource).DataBound("dataBound").Columns(col =>
{
…
}).AllowPaging().Width("100%").PageSettings(page=> { page.PageCount(5); page.PageSize(10); }).Render()
<script>
function dataBound() {
var grid = document.getElementById('Grid').ej2_instances[0];
var num = grid.getCurrentViewRecords();
console.log(num)
if (num.length < 15) { // here consider 15 has the specific amount of records
alert("The current view Records is : " + num.length+ " It is less than the specific amount of 15"); // alert message
}
}
</script>
|