Knockout binding is bloating html (table cells), how to create bindings with javascript or bind from parent element? -


i've created reusable grid component via knockout , i'm finding html becoming bloating data-bind="..." strings particularly <td> elements.

i have grid 8 columns , mere 20 rows yield 160 cells. issue cells this:

<td data-bind="text: typeof rowtext == 'function' ? rowtext($parent) : $parent[rowtext], event: { dblclick: function() { $root.rowdoubleclicked($parent); } }, css: $data.columnclass">yale university</td> 

i may add future bindings.

it'd nice if there way perhaps apply binding <tbody> automatically apply binding it's child <td> elements. or perhaps there way apply bindings via javascript instead of using "data-bind" attribute?

normally 1 looking @ code (developer), looks unimportant in grand scheme of things. format markup make easier follow:

<td data-bind="     text: typeof rowtext == 'function' ? rowtext($parent) : $parent[rowtext],     event: { dblclick: function() { $root.rowdoubleclicked($parent); } },     css: $data.columnclass">yale university</td> 

your text binding cleaned pushing check viewmodel, perhaps using computed check you.

knockout templates may "pretty up" markup, it's moving around anyways.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -