Advanced Search Widget

Plugin Development

Suggested Topics


  • Accesing JQuery in widget template

    Unsolved Plugin Development
    0 Votes
    2 Posts
    265 Views

    Javascript embedded in the widget can't access the jquery object on page load since jquery hasn't loaded yet. You can use something like this

    (function() { function onLoad() { // widget code } if (window.jQuery) { onLoad(); } else { window.addEventListener('DOMContentLoaded', onLoad); } })();
  • 0 Votes
    1 Posts
    809 Views

    Good morning.

    First of all, I'm not a developer, and I'm sorry for every noob question that comes up here.

    Right now I'm playing around with the plugin/widget development. My goal is to have a widget which includes a search bar and a result div. Every change in the search input field fires a jquery request against a foreign api. Result is a big json object, containing an array of objects (example fields: image, name, uuid, type).

    I was able to put the plain results into the div. Now I want to process these results (splitting them up by type) and render them into beautiful partials.

    For your imagination:
    <search box>
    <box for type A with a list of entries> <box for type B with a list of entries>...

    Can anyone please give me a headstart?

    Thanks in advance.

  • JQuery in Widget Template

    Solved Plugin Development
    0 Votes
    3 Posts
    2k Views

    You can close this thread..

    Resolved by using app.loadJQueryUI()

  • 0 Votes
    6 Posts
    2k Views

    @Fez-Vrasta You have to include it. e.g. var SocketIO = require('./socket.io');

    I'm not sure if there is an option for per widget client js. I put it in my main client.js in my plugin.json.

  • 0 Votes
    4 Posts
    2k Views

    Like this?

    https://github.com/NodeBB/nodebb-widget-essentials/blob/master/public/templates/widgets/activeusers.tpl

    This pre-renders the list of active users from server data. And then has some inline JS with socket call to update the list as new users become active