When I run the console.log
as follows in the initialize
function defined in the code below:
console.log("Checking for Value_Of_Process_Type in Initialize Function ! :" +Value_Of_Process_Type);
console.log("Checking for Todays Date in Initialize Function ! :" +TodaysDate)
;
I get undefined
for both the variables. However, I see the values of both the variables in the following console.log
defined inside the click handler of processEmployeeData
function:
console.log("Value_Of_Process_Type and Value_Of_TodaysDate are as follows :"+Value_Of_Process_Type+" and "+TodaysDate);
So basically, my variables are not getting passed from the function processEmployeeData
to the initialize function. Is there any other approach I can follow to make that happen or anything wrong that I am doing?
function EmployeePage() {
var self = this;
this.getNLPData = function (employee_number_) {
var url = AppManager.getWebServiceURL(self.urlNLPKey);
if (isEmpty(url)) { alert("Invalid URL in getNLPData()"); return false; }
var ajaxRequest = jQuery.ajax({
data: {
employee_id: AppManager.employee.id,
employee_number: employee_number_,
},
dataType: "json",
method: "GET",
url: url
})
.done(function (data_, textStatus_, jqXHR_) {
self.processEmployeeData(data_.employee_document_list);
})
.fail(function (jqXHR_, textStatus_, errorThrown_) {
alert("Error in getNLPData(): " + errorThrown_);
return false;
});
};
// Initialize the page
this.initialize = function () {
var employee_number = AppManager.selectedData["employee_number"];
console.log("employee_number By calling page:" +employee_number);
var Value_Of_Process_Type = AppManager.selectedData["my_page.Process_Type"];
var TodaysDate = AppManager.selectedData["my_page.date_value"];
console.log("Checking for Value_Of_Process_Type in Initialize Function ! :" +Value_Of_Process_Type); //outputs undefined here
console.log("Checking for Todays Date in Initialize Function ! :" +TodaysDate); //outputs undefined here
};
this.processEmployeeData = function (collection_) {
var source =
{
localdata: collection_,
datatype: "array"
};
var dataAdapter = new $.jqx.dataAdapter(source, {
loadComplete: function (data) { },
loadError: function (xhr, status, error) { }
});
$("#nlpDocumentPanel").jqxGrid(
{
source: dataAdapter,
width: '1000',
height: 150,
columns: [
{
text: 'Type', datafield: 'nc_type'
},
{
text: 'Process_Type', datafield: 'processType'
{
text: 'Date', datafield: 'date_value'
}
]
});
$("#nlpDocumentPanel").on('rowclick',function(event){
row = event.args.rowindex;
datarow = $("#nlpDocumentPanel").jqxGrid('getrowdata', row);
var response = JSON.stringify(datarow,null,10);
//console.log("Datarow JSON Response:"+response);
var Process_Type = datarow["processType"];
AppManager.selectData("my_page.Process_Type", Process_Type);
var Value_Of_Process_Type = AppManager.selectedData["my_page.Process_Type"];
var TodaysDate = datarow["date_value"];
AppManager.selectData("my_page.date_value", TodaysDate);
var Value_Of_TodaysDate = AppManager.selectedData["my_page.TodaysDate"];
console.log("Value_Of_Process_Type and Value_Of_TodaysDate are as follows :"+Value_Of_Process_Type+" and "+TodaysDate);
//initialize(Value_Of_Process_Type,TodaysDate);
console.log("Reached below initialize function inside click handler");
});
};