setting.view.fontCss.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <div class="apiDetail">
  2. <div>
  3. <h2><span>JSON / Function(treeId, treeNode)</span><span class="path">setting.view.</span>fontCss</h2>
  4. <h3>Overview<span class="h3_info">[ depends on <span
  5. class="highlight_green">jquery.ztree.core</span> js ]</span></h3>
  6. <div class="desc">
  7. <p></p>
  8. <div class="longdesc">
  9. <p>Personalized text style, only applies to &lt;A&gt; object in the node DOM</p>
  10. <p>Default: {}</p>
  11. </div>
  12. </div>
  13. <h3>JSON Format</h3>
  14. <div class="desc">
  15. <p>As same as .css() method in jQuery. e.g. <span
  16. class="highlight_red">{color:"#ff0011", background:"blue"}</span></p>
  17. </div>
  18. <h3>Function Parameter Descriptions</h3>
  19. <div class="desc">
  20. <h4><b>treeId</b><span>String</span></h4>
  21. <p>zTree unique identifier: <b class="highlight_red">treeId</b>.</p>
  22. <h4 class="topLine"><b>treeNode</b><span>JSON</span></h4>
  23. <p>JSON data object of the node which use the personalized text style</p>
  24. <h4 class="topLine"><b>Return </b><span>JSON</span></h4>
  25. <p>Return value is same as 'JSON Format'. e.g. <span class="highlight_red">{color:"#ff0011", background:"blue"}</span>
  26. </p>
  27. </div>
  28. <h3>Examples of setting & function</h3>
  29. <h4>1. Don't modify css file, and set the node name's color to red</h4>
  30. <pre xmlns=""><code>var setting = {
  31. view: {
  32. fontCss : {color:"red"}
  33. }
  34. };</code></pre>
  35. <h4>2. Don't modify css file, and set the root node name's color to red</h4>
  36. <pre xmlns=""><code>function setFontCss(treeId, treeNode) {
  37. return treeNode.level == 0 ? {color:"red"} : {};
  38. };
  39. var setting = {
  40. view: {
  41. fontCss: setFontCss
  42. }
  43. };</code></pre>
  44. </div>
  45. </div>