Hi,
I am developing a web application for the firm using MVC & Knockout. I am very much new to MVC and Knockout. In the admin side I need to display the users who are applied, approved, rejected in the Grid format.
I wrote controller to get AllUsers and I can able to bind all those users to Table. And I want to filter them at the client side using knockout to reduce the round trips to DB. It will boost my application performance.
So, what I need is: how can I check whether the user is Approved or Rejected using Knockout and based on that check I need to bind that data to separate Tables.
I googled about this and I could not able to understand properly as I am very much new to this Technology.
Can some body help me on this.
here is my client side code using Knock out
function UserViewModel(){
var self=this;
self.UserName = ko.observable("");
self.ContactNo = ko.observable("");
self.Email = ko.observable("");
self.User_ID = ko.observable("");
self.IsApproved = ko.observable("");
var ApprovedUsers = {
UserName: self.UserName,
ContactNo: self.ContactNo,
Email: self.Email,
User_ID: self.User_ID,
IsApproved: self.IsApproved
};
self.ApprovedUsers = ko.observableArray();
$.ajax({
url: "Home/GetAllUsers",
cache: false,
type: "JSON",
contentType: "application/json; charset=utf-8",
data: {},
success: function(data){
self.ApprovedUsers(data);
}
});
}
$(document).ready(function(){
var viewModel = new UserViewModel();
ko.applyBindings(viewModel);
});
I can able to bind all the data by using the above code, but it was included all type users (Approved, Applied & Rejected).
How can I check the value of Property "IsApproved" on client side and based on that How can I filter the data using KnockOut?
Thanks in advance
Murali Krishna