I cannot tell if this is my lack of understanding of javascript or how the jquery/dataAdapter is accessing this var.
I make a change to a global variable within an event but the POST variable is not being updated when it send to the back end.
Im sure this is simple but Im sure I had this working at some point but staring at this for a couple of hours and setting up test code I am at a loss as to what I am doing wrong here.
Thanks
<script type=”text/javascript”>
$(document).ready(function () {
slaFilter = “OFF”;
$(“#jqxCheckBoxSLA”).jqxCheckBox({ width: 120, height: 25});
$(“#jqxCheckBoxSLA”).on(‘change’, function (event) {
var checked = event.args.checked;
if (checked) {
slaFilter = “ON”;
$(“#customersGrid”).jqxGrid(‘clear’);
$(“#customersGrid”).jqxGrid(‘updatebounddata’, ‘cells’);
}
else {
slaFilter = “OFF”;
$(“#customersGrid”).jqxGrid(‘clear’);
$(“#customersGrid”).jqxGrid(‘updatebounddata’, ‘cells’);
}
});
sourceTable =
{
datatype: “json”,
type: “POST”,
data: {slaFilter}, <—- This is not reflecting the new value updated in event
//async: false,
url: “/sqlTickets/getActiveTickets”,
datafields: [
{ name: ‘ticket_number’ },
]
};
dataAdapterTable = new $.jqx.dataAdapter(sourceTable);
$(“#customersGrid”).jqxGrid(
{
code truncated ….
}
</script>