Collapse rows in treeview-table onLoad (HTML) with javascript -


i have treeview-table used collapse , expand data, how can show collapsed rows on load? use collapse-expand:

 if (tr.hasclass('collapse')) {             tr.removeclass('collapse').addclass('expand');             children.hide();         } else {             tr.removeclass('expand').addclass('collapse');             children.show();         }         return children; 

this jsfiddle: http://jsfiddle.net/vd5bh/79/

just add in end:-

  $('.toggle').trigger('click'); 

based on current logic toggling on clicked span.toggle current state. in document ready right @ end trigger click event span.trigger. make of them collapsed.

fiddle


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -