slickgrid와 함께 녹아웃 사용 제대로 작동하려면 행을 추가 할 수 있지만 작동하도록 개별 속성 편집을 할 수 없습니다. 그것은이 오류가 발생합니다 :Slickgrid에서 녹아웃을 사용하는 적절한 방법은 무엇입니까
Uncaught TypeError: Property 'ProductName' of object #<Product> is not a function
를 그래서 나는 단지 내가 풀어 경우 올바른 값이 표시 얻을 수 내 개체 속성에 관찰 가능한 사용하고 있기 때문에 내 bindingHandler과 관련이있다 데이터를 다시 평가 :
var data = ko.utils.unwrapObservable(settings.data);
$.each(data, function(index, item) {
var prop;
for (prop in item) {
if (item.hasOwnProperty(prop)) {
data[index][prop] = ko.utils.unwrapObservable(data[index][prop]);
}
}
});
var columns = ko.utils.unwrapObservable(settings.columns);
var options = ko.utils.unwrapObservable(settings.options) || {};
grid = new Slick.Grid(element, data, columns, options);
그리고 편집 기능은 내 뷰 모델에 놓여 :
function ViewModel(data) {
var self = this;
self.gridData = ko.observableArray(data);
self.columns = [
{
name: 'Product ID',
id: 'ProductId',
field: 'ProductId'},
{
name: 'Color',
id: 'ColorName',
field: 'ColorName'},
{
name: 'Sku',
id: 'Sku',
field: 'Sku'},
{
name: 'Product Name',
id: 'ProductName',
field: 'ProductName'}
];
self.fnTestClickEdit = function() {
self.gridData()[0].ProductName("Product has been Edited " + new Date());
};
}
그러나 이것으로 막 다른 골목에 처박혀있는 것을보고, 여기 내 구현에서 맹목적으로 잘못된 것을하고 있습니까? 여기
함께 넣어 모두의 jsFiddle입니다 :KoGrid came out of our need for a decent datagrid that was built for MVVM/Knockout-style development. It draws considerable inspiration and architecture from SlickGrid, but is still KO throughout.
나는 그것을 시도하지 않은 (:
이
나는이 작품을 얻을 수 있었지만 내 물건에는 참된 관찰 가능한 속성이 없었다. 나는 배열의 객체를 교체해야하고, 관찰 가능한 배열은 업데이트를 추적하지만, 아직 속성이 왜 나오지 않는지 아직 알지 못합니다. 새로운 피들 : http://jsfiddle.net/sbrqB/8/ – cjsmith