Hi,
I am novice, so i will sound like that..
I am working on MVC ajax project. In this in model i have a property self.responseType. I need to fill it from db.
I am ok getting array (two dimensional) from db to my datacontext .js file.
So in my model i have below code
self.responseType = ko.observableArray([]);
datacontext.getDropdownValue(
self.responseType, 8);
Now
getDropdownValue is the function in dataContext which fetch data from db based on value (here 8 as parameter) and set it to
self.responseType
Now in datacontext following is the code for function
function getDropdownValue(
option,id) {
clearErrorMessage();
return ajaxRequest("get", getEnumUrl(id))
.done(getSucceeded);
function getSucceeded(data) {
var variable = [];
variable = importEnumOptions(data);
option(variable);
}
}
function importEnumOptions(data) {
var databound = function (label, value) {
this.label = label;
this.value = value;
};
return $.map(data || [],
function (item) {
return new databound(item.VName, item.VCode);
});
}
The problem is i am getting two dimensional array in '
option' variable but that is not setting value of
self.responseType. and even the debugger is losing some where .. Not sure.. Can some one help me with this..