Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Adding External Java Script Libraries to CDE

  1. #1

    Default Adding External Java Script Libraries to CDE

    Hello,

    I would like to add external java script libraries to CDE so that it would be available to ALL dashboards, how do I do that? I understand that we could go to Layout ->Add Resource -> External File to add libraries like chosen, https://github.com/harvesthq/chosen/releases. But is there any better way to do this so that the same java script library can be shared for all dashboards? like jquery.js for exmaple? Do I simply drop the .js file in the same location as jquery.js?

    What I would like to do is replace all the select components with chosen select, by doing the following:
    $( "select" ).addClass( "chosen-select" );
    var config = {
    '.chosen-select' : {},
    '.chosen-select-deselect' : {allow_single_deselect:true},
    '.chosen-select-no-single' : {disable_search_threshold:10},
    '.chosen-select-no-results': {no_results_text:'Oops, nothing found!'},
    '.chosen-select-width' : {width:"95%"}
    }
    for (var selector in config) {
    $(selector).chosen(config[selector]);
    }

    However, it did not work. Because the function call happens before the dashboard gets rendered.... How do I manipulate dashboard object using external java script files...


    Thanks in advance.

  2. #2
    Join Date
    Jul 2007
    Posts
    2,497

    Default

    The answer to your question is a text file called something like resources.txt that lists the dependencies.

    What you'll probably be delighted to know is that we actually already support chosen out of the box! In all CDE selectors, you have a property called "plugin" or something. Type "chosen" there and.... done!


    (the other plugin we support is 'hynds')
    Pedro Alves
    Meet us on ##pentaho, a FreeNode irc channel

  3. #3

    Default

    That's awesome! I was always wondering why there is an JQuery Plugin option and didn't know what that is for. Hidden feature! great.

    Pedro, could you explain a little bit more on resource file that list dependencies? where do we put this text file, and when does the application look up this resource file, what is expected from this resource file?

    The reason I asked is it is possible I might end up using other 3rd party jQuery libraries, but hoping to understand how I can do it properly.

    Thank you again for the reply!!

  4. #4
    Join Date
    Feb 2013
    Posts
    530

    Default

    I have given
    jQuery Plugin=chosen for Month select component(an SQL query).

    when see the preview it is showing component error processing error ?

    How can I change the style of input controls (drop downs/buttons) with this chosen selected and with css ?

    Hints would be appreciated....


    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.