setting.view.fontCss.html 1.6 KB

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