I am using Sigma grid in an asp.net project. I want to display that no record is found if the DB returns null. I have tried a few things like:
var grid = Sigma.$grid(grid_demo_id);
var test1 = grid.dataset.getSize();
But it always return -1 whether are are records or not.
I am pasting my code below:
var grid_demo_id = "myGrid1";
var dsOption = {
fields: [
{ name: 'col1' },
{ name: 'col2' }
],
recordType: 'array'
}
var colsOption = [
{ id: 'col1', header: "Col1", width: 105 },
{ id: 'col2', header: "Col2", width: 131 }
];
var gridOption = {
id: grid_demo_id,
loadURL: 'Controller.aspx?P=Location&LocationId=' + globalLocation + '&' +strDate,
width: "448",
height: "239",
container: 'tabcontainer',
replaceContainer: true,
encoding: 'UTF-8', // Sigma.$encoding(),
dataset: dsOption,
columns: colsOption,
clickStartEdit: true,
defaultRecord: { 'col1': "00", 'col2': ""},
pageSize: 7,
pageSizeList: [7, 14, 21],
toolbarPosition: 'bottom',
toolbarContent: 'reload | nav | goto | pagesize | print '
};
var mygrid = new Sigma.Grid(gridOption);
Sigma.Util.onLoad(function () { mygrid.render() });
var grid = Sigma.$grid(grid_demo_id);
var test1 = grid.dataset.getSize();
alert(test1);
if (test1 === -1) {
alert('In');
document.getElementById('DivGridView').innerHTML = '<div id=\'divRec\'style=\'float:left;\'>No Record found.</div>';
document.getElementById('tabcontainer').style.display = "none";
}
else {
document.getElementById('tabcontainer').style.display = "block";
document.getElementById('DivGridView').style.display = "none";
}