Announcement

Collapse
No announcement yet.

TypeError When Using a JS Library

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • TypeError When Using a JS Library

    In order to use a UI component from an external JS library in SC, I'm referencing the library's JS/CSS from onAppInit of a single form app.

    When there is an SC quicksearch field on the form, the magnifying glass icon does not show and I see the following in the console:

    TypeError: $(...).listen is not a function

    $('#SC_fast_search_t').listen();

    When there is a date field with calendar drop down, the button to activate the calendar does not show and I see the following in the console:

    TypeError: $(...).datepicker is not a function

    $("#id_sc_field_lastinteractdate" + iSeqRow).datepicker({

    I'm very aware of the risks of venturing outside the SC playground Netmake has made but I wonder if there is a little config that can prevent this.

    It is very unlikely another library uses an element called "SC_fast_search_t" to clash with SC so why would the error be coming up?

  • #2
    Inspect DOM. Maybe you are not using right selectors .

    What are you trying to achieve? How are you adding your external JS?
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      Originally posted by Giu View Post
      Inspect DOM. Maybe you are not using right selectors .

      What are you trying to achieve? How are you adding your external JS?
      In the onApplicationInit I'm echoing the HTML head and opening body tags (with no closing).

      Here I send all the <link rel="stylesheet" href="..."> and <script src="..."> statements required.

      The issues is now fixed thank you: I realized one of my link rels was referring to jquery.min.js which SC already has.

      Now I feel like the boy who cried wolf! Sorry for the false alarm.

      Comment

      Working...
      X