2013-02-21 9 views
5

Applicazione corrente, qualcuno ha utilizzato require-jquery.js. Ora ho implementato la tabella di dati jQuery. Funziona bene quando si rimuove "require-jquery.js". Ma quando includo require-jquery.js sto ottenendo l'errore sotto:conflitto di tabelle di dati con require-jquery.js

Error: Mismatched anonymous define() module: function ($) {

vedere la struttura:

  1. jquery.min.js
  2. richiedono-jquery.js
  3. jquery .dataTables.js

E questo:

tickerdashboardtable = $('#tickerdashboardtable').dataTable({}); 

Non so come usare require-jquery.js. Come può risolvere questo problema.

+2

http://requirejs.org/docs/errors.html#mismatch –

+0

Potete mostrare un po 'di codice? Dove stai definendo 'require-jquery.js'? –

+0

struttura è, 1.jquery.min.js 2.require-jquery.js 3.jquery.dataTables.js $ (document) .ready (function() { \t tickerdashboardtable = $ ('# tickerdashboardtable') .dataTable ({}) \t}); – Manivasagan

risposta

0
<script data-main="scripts/main.js" src="scripts/jquery.js"></script> 

Creare un main.js che contiene qualcosa di simile a:

require(["jquery", "jquery.alpha", "jquery.beta"], function($) { 
    //the jquery.alpha.js and jquery.beta.js plugins have been loaded. 
    $(function() { 
     $('body').alpha().beta(); 
    }); 
}); 

Dovete chiamare tutti gli script che utilizzano "definiscono()" dal API richiedono-jQuery.

http://requirejs.org/docs/jquery.html