I am new to KnockOutJs and I am implementing it as well as KoGrid. I have a grid set up that populates data from the data in IE8 but does not work in Chrome or FF.
Javascript –
function FillViewModel(data) {
var vm = {
MyResults: ko.observableArray(data)
};
return vm;
}
$(function () {
$.post("/Controller/Search", function (returnedData) {
ko.applyBindings(FillViewModel(JSON.parse(returnedData)));
})
});
The method in the controller.
[HttpPost]
public string Search()
{
List<myData> resultList;
resultList= _context.SelectAll();
JavaScriptSerializer s = new JavaScriptSerializer();
string json = s.Serialize(resultList);
return json;
}
Then I am populating it in my view as such.
<div id="myTable" data-bind="koGrid: { data: MyResults}">
</div>
As I said, it populates fine all 200 something rows in IE, but when I try to run it in FF or Chrome, it appears to all be called but the grid never shows.
I had a display: none that was taking over. What it came down to was I had some html 5 content that was being ignored in IE8 (hence the display: none on the object was being ignored” but Chrome and FF would recognize the html5 element and so the grid wouldn’t show because of the display on it. Silly error.