Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Implementing jquery on Tree Checkbox (build from scratch - no plugin)
    primarykey
    data
    text
    <p>I don't know if the following Hierarchical Data is Adjacency list or Nested List model. What i know is, it's easy to collect the hierarchical data. For example, </p> <p>to get all the tree then use : SELECT * FROM categories ORDER BY trn ASC</p> <p>to get all the tree start from item News (7) : SELECT * FROM categories WHERE trn LIKE '%+7+%'</p> <p>It just a single query, instead of doing looping parent-child query.</p> <pre><code>catID cat_title status trn trn_level 7 News publish +7 0 8 Artikel publish +8 0 9 Public Training draft +7+9 1 10 Coorporate Mgt draft +8+10 1 16 MS Based On IS draft +7+9+16 2 17 Inhouse Training draft +7+17 1 18 MS publish +7+17+18 2 19 SM publish +7+17+19 2 </code></pre> <p>So... my jQuery problem is: The datas above will produce checkbox html like the following :</p> <pre><code>News Inhouse Training MS SM Public Training MS Based On IS Artikel Coorporate Management &lt;ul class="categoriesTree"&gt; &lt;li&gt; &lt;?php str_repeat("&amp;nbsp;&amp;nbsp;",$row['trn_level']); ?&gt; &lt;input type="checkbox" name="categories[]" value="&lt;?php echo $row['catID']; ?&gt;" class="&lt;?php echo $row['trn']; ?"&gt; &lt;?php echo $row['cat_title']; ?&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>How to perform parent-child checked with jQuery. Example : if i checked on item News, i want it will also checked item - Inhouse Training - MS - SM - Public Training - MS Based On IS</p> <p>Basicly i want to perform a parent child checked, if the child checked first, the the reference parent of the item will also checked, if the parent checked first then all the childs will checked.</p> <p>I hope what I mean is clear enough :). I know that there are lots of tree plugin ready to use, but i want to understand &amp; build my own from scratch.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload