When trying to run an if statement with Javascript on a Jexcel to look at Cell 1,1 it seems to remove all the cells and leaves just one cell with a number 1 in it. I am new to Javascript so it is quite possible I am just not understanding it well enough, so dont be surprised if I have got the code completely wrong as my background is VBA. However if someone could just guide me on how to get it to look in one cell I am sure I can write the rest.
I have been trying to get the on-line guides on Jexcel to try understand it but I am not getting what I am missing. I have tried to follow the guide on the following https://www.teamdev.com/downloads/jexcel/docs/JExcel-PGuide.html
but I am not getting exactly what I want it to do, which is look at the cell and follow a process depending if it is empty or not. It doesn't debug so I am not sure what else to try.
<script>
function findIt() {
var r = confirm("This will find all data, do you wish to
proceed?");
if (r == true) {
$('#FRSTable').jexcel(data,{
table: function (instance, cell, col, row, val, id) {
cell = worksheet.getcell(1,1);
if (cell() == null)
{
alert("Please Enter a Value");
}
}
});
} else {
alert ( "You pressed Cancel!");
}
}
</script>
So what I expect is for it to say Please enter a value, what happens is all the Cells get removed and a single box with a number 1 replaces it, this resets after reloading the page.
The guide you are looking for actually is here. But, actually, jExcel brings a native searchable option.
<html>
<script src="https://bossanova.uk/jexcel/v3/jexcel.js"></script>
<script src="https://bossanova.uk/jsuites/v2/jsuites.js"></script>
<link rel="stylesheet" href="https://bossanova.uk/jexcel/v3/jexcel.css" type="text/css" />
<link rel="stylesheet" href="https://bossanova.uk/jsuites/v2/jsuites.css" type="text/css" />
<div id="spreadsheet"></div>
<script>
jexcel(document.getElementById('spreadsheet'), {
csv:'https://bossanova.uk/jexcel/v3/demo.csv',
csvHeaders:true,
search:true,
pagination:10,
columns: [
{ type:'text', width:300 },
{ type:'text', width:200 },
{ type:'text', width:100 },
{ type:'text', width:100 },
{ type:'text', width:100 },
]
});
<script>
</script>
</html>
The example above can be found at: https://bossanova.uk/jexcel/v3/examples/datatables