Does KoGrid support context menu out of the box. If not could someone point me as to how to show context menu on right click of a row in KoGrid.
Asked
Active
Viewed 233 times
1 Answers
1
After a quick look in the source at https://github.com/Knockout-Contrib/KoGrid/blob/master/koGrid-2.1.1.debug.js
Around line 200 you can see that you can modify the templates it uses.
/***********************************************
* FILE: ..\src\templates\rowTemplate.html
***********************************************/
window.kg.defaultRowTemplate = function(){ return '<div data-bind="style: { cursor : canSelectRows ? \'pointer\' : \'default\' }, foreach: $grid.visibleColumns, css: { \'ui-widget-content\': $grid.jqueryUITheme }"><div data-bind="attr: { \'class\': cellClass() + \' kgCell col\' + $index() }, kgCell: $data"></div></div>';};
/***********************************************
* FILE: ..\src\templates\cellTemplate.html
***********************************************/
window.kg.defaultCellTemplate = function(){ return '<div data-bind="attr: { \'class\': \'kgCellText colt\' + $index()}, html: $data.getProperty($parent)"></div>';};
Those are the defaults, you can modify them to have whatever bindings you want. Note: you'll have to do this after the kogrid script is loaded and before you call ko.applyBindings

scaryman
- 1,880
- 1
- 19
- 30