$('#ProductCategoryId option').each( function(idx) {
thisIndent = $(this).text().split('—').length - 1;
nextIndent = $(this).next().text().split('—').length - 1;
if (nextIndent > thisIndent) {
$(this).replaceWith('<optgroup label="' + $(this).text() + '"/>');
}
});
On Sunday, May 27, 2012 12:15:44 PM UTC+3, r4zv4n wrote:
I have a categories tree structure (ragged) and products. With the default behavior (i.e. using generateTreeList() ), when adding / editing a product, I can assign it to categories on any level.However, I'd like to only give the user the possibility of assigning products to leaf level categories. I would, however, like to present the user with the entire tree structure, as some category names can be ambigous (e.g. repeated for men / women).The way I imagined this was to generate a select dropdown, but with some of the options disabled (all but leaves) - but I'm not really sure how to go about doing that. I went through the options of generateTreeList(), find('threaded') and any other available methods of the Tree Behavior. Nor do I see options for disabling elements of a select in the Form Helper.Which way would you suggest I go?Thanks!
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment