-1

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.

Sajid
  • 81
  • 2
  • 10

1 Answers1

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