CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • [SOLVED] Including jsTree Plugin
Pages: [1]

Author Topic: [SOLVED] Including jsTree Plugin  (Read 619 times)

TeNNoX

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
  • CiviCRM version: v4.4.x
  • CMS version: Drupal v7.x
  • MySQL version: newest
  • PHP version: PHP 5
[SOLVED] Including jsTree Plugin
August 27, 2014, 10:31:03 am
How can I use jsTree properly?

The "Tags" tab on the page for an existing contact uses jsTree, but I can't find where the code is that says the page should load the jsTree script...
I tried adding:
Code: [Select]
{crmScript ext=civicrm.jquery.plugins.jstree file=jquery.jstree.js region=html-header} to TagsAndGroups.tpl
or
Code: [Select]
CRM_Core_Resources::singleton()->addScriptFile('jquery.jstree', 'jquery.jstree.js', 10, 'html-header'); to TagsAndGroups.php

What's the correct way to do it?
« Last Edit: August 29, 2014, 04:14:31 am by TeNNoX »

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Including jsTree Plugin
August 27, 2014, 12:03:41 pm
It's really not that simple. jsTree requires list-style markup, and the contact edit screen uses tabular markup to contain the checkboxes.
Try asking your question on the new CiviCRM help site.

TeNNoX

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
  • CiviCRM version: v4.4.x
  • CMS version: Drupal v7.x
  • MySQL version: newest
  • PHP version: PHP 5
Re: Including jsTree Plugin
August 28, 2014, 03:06:31 am
Quote from: Coleman Watts on August 27, 2014, 12:03:41 pm
It's really not that simple. jsTree requires list-style markup, and the contact edit screen uses tabular markup to contain the checkboxes.

I already ported the list-style markup:
http://forum.civicrm.org/index.php/topic,33934.msg144110.html#msg144110

The only thing I need is to correctly import jsTree, I'm using
Code: [Select]
CRM_Core_Resources::singleton()->addScriptUrl('http://10.0.0.2/crm/sites/all/modules/civicrm/packages/jquery/plugins/jstree/jquery.jstree.js?napuqq', 10, 'html-header');at the moment but I think it's not the perfect solution. (e.g. when the server gets a different address...)

TeNNoX

  • I post occasionally
  • **
  • Posts: 36
  • Karma: 0
  • CiviCRM version: v4.4.x
  • CMS version: Drupal v7.x
  • MySQL version: newest
  • PHP version: PHP 5
Re: Including jsTree Plugin
August 29, 2014, 04:14:19 am
Here's the solution:

Code: [Select]
CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'packages/jquery/plugins/jstree/jquery.jstree.js', 0, 'html-header', FALSE);

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • [SOLVED] Including jsTree Plugin

This forum was archived on 2017-11-26.