Does KoGrid supports context menu?

243 views Asked by At

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.

1

There are 1 answers

0
scaryman On

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