pjekel / cbtree

The Dijit Tree with Multi State Checkboxes, project code 'cbtree' , is a highly configurable dojo/dijit tree with support for multi-state checkboxes or third party widgets capable of presenting a so-called 'checked' state.
Other
75 stars 34 forks source link

Identify branch #39

Closed bridgji closed 10 years ago

bridgji commented 11 years ago

Great component. Its working great for me. I just have one question .

I'm currently setting a background image and cursor for the labels using css. .dijitTreeLabel {cursor:pointer; background-repeat:no-repeat; background-image:url(images/button2.gif); background-position:right; }

I'd like to have a different image and cursor on the branch labels versus the leaf labels. I was hoping to use something like this but I can't seem to find anything that identifies if its a leaf or branch.

.dijitTreeLabel[ type="leaf"] { cursor:initial; background-repeat:no-repeat; background-image:url(images/button5.gif); background-position:right; }

I'm kind of a noob at this so I may be way off in how I'm trying to do this. Thanks for your time, Jim

pjekel commented 11 years ago

Ok, I have added the expandable attribute to tree node HTML elements with class dijitTreeRow which will allow you to use selectors like:

<style type="text/css">
    .dijitTreeRow[expandable="true"] .dijitTreeLabel {
        backgound-color: yellow
    }
</style>

Or

require(["dojo/query", ... ], function(query, ... ) {
    query(".dijitTreeRow[expandable='true'").forEach(function (domNode) {
                                                 ....
    });
});

The new expandable attribute will make is very easy to distinguish between tree branches and leafs. For the time being, fetch cbtree/Tree.js directly from the cbtree github repository. The updated Tree will be included in the next downloadable release of cbtree (e.g. cbtree-v0.9.3-4)

I have updated the Wiki providing additional info and examples.

My earlier response suggested to modify the cbtree node template however, that does not work properly with dynamic trees and widget properties. (the original response has been removed).

Hope this helps.

bridgji commented 11 years ago

This is working great, it was exactly what I needed. Thank you for such a quick response and making these changes. Is there any way I can help support this?

pjekel commented 11 years ago

This feature is now available as part of cbtree v0.9.4