ADA15
ADA15

Reputation: 86

No inputNode specified. when using YUI Library

I'am working on a project and am trying to use YUI Library to filter the result in a list by typing a filter word, the probleme is that somtimes this work fine other times it's just break down saying : Uncaught Error: No inputNode specified.

this is my JS function :

YUI(YUI3_config).use('autocomplete-base', 'autocomplete-filters', function (Y) {
// Create a custom PieFilter class that extends AutoCompleteBase.
var PieFilter = Y.Base.create('pieFilter', Y.Base, [Y.AutoCompleteBase], {
  initializer: function () {
  this._bindUIACBase();
  this._syncUIACBase();
  }
}),

// Create and configure an instance of the PieFilter class.
filter = new PieFilter({
inputNode: '#ac-input20',
minQueryLength: 0,
queryDelay: 0,

source: (function () {
  var results = [];

  Y.all('#list31 > .list31, #list31 > .list32').each(function (node) {
    results.push({
      node: node,
      tags: node.getAttribute('data-tags')
    });;
  });

  return results;
  }), 
  resultTextLocator: 'tags',

  resultFilters: 'phraseMatch'
});

filter.on('results', function (e) {
Y.all('#list31 > .list31, #list31 > .list32').addClass('hidden');

   Y.Array.each(e.results, function (result) {
   result.raw.node.removeClass('hidden');
 });

}); });

and this is my HTML :

<div id="play30" class="liste-donnees block ezcca-edit-datatype-ezdate">
<fieldset>
    <legend>
        <span class="long-legend-wrap">Ressources
            <span class="classattribute-description"></span>
        </span>
    </legend>
    <div style='width: 400px;'>
        <label for="ac-input20">Filtre:</label>
        <input id="ac-input20" type="text">
        <ul id="list31" class="liste-gauche"></ul>
    </div>    
    <p style='float: left;margin-top: 150px;font-weight: bold'>=====></p>
    <ul id="list32" class="liste-droite"></ul>    
</fieldset>

any ideas, thanks for your help in advance

Upvotes: 0

Views: 347

Answers (1)

Mathias C
Mathias C

Reputation: 125

Usually, "No inputNode specified." error is thrown when the specified input (ie. '#ac-input20') cannot be found.

Obyously this sounds silly here, as it's been declared in your HTML; when the error occurs, have you checked the HTML source to get sure the 'ac-input20' element exists ?

Also, you are targetting '#list31 > .list31' elements but in your HTML, no element has a class named 'list31'.

Hope this helps in any way.

Upvotes: 1

Related Questions