I tried using the js file for including the pagination in my webpage but it is showing in browser console TypeError: $(...).pagination is not a function
What can be the possible problem/issue with it?
Note: I am using require.js to get the scripts loaded.
Please replay, thanks in advance
This is my require module named as testPagination.js
define(['jquery','pagination'], function($,pagination) {
/* GET DATASOURCE FROM HIDDEN FIELD */
function Hello() {
alert('helo...!!!');
}
function loadPagination(total)
{
alert("PAGINATION CALLED");
$('#listing-paginationtest').pagination({
items : total,
itemsOnPage : 10,
cssStyle : 'dark-theme',
onPageClick : function(pageNumber) {
}
});
alert("PAGINATION END");
}
return {
Hello:Hello,
loadPagination:loadPagination
};
});
and I am calling this module method like this in main.js
require.config({
baseUrl : "js",
paths : {
"text" : "libs/require/plugins/text",
"jquery" : "libs/jquery/jquery",
"blockUI" : "libs/jquery/plugins/jquery.blockUI",
"pagination" : "libs/jquery/plugins/jquery.simplePagination",
"cookie" : "libs/jquery/plugins/jquery.cookie",
"backbone" : "libs/backbone/backbone",
"underscore" : "libs/underscore/underscore",
// BACKBONE MODELS
"models" : "models/models",
"templates" : "../templates",
"plugins" : "libs/jquery/plugins",
"pages" : "pages",
"util" : "modules/store/util",
"store" : "modules/store/main",
// MODULES
"datasourceModule" : "modules/datasourceModule",
"cookieModule" : "modules/cookieModule",
"testPagination":"modules/testPagination"
"bootstrap" : "../design/js/bootstrap.min",
},
waitSeconds: 200,
shim : {
'jquery' : {
exports : '$'
},
'backbone' : {
deps : [ 'underscore', 'jquery' ],
exports : 'Backbone'
},
'underscore' : {
exports : '_'
},
'models' : {
deps : [ 'backbone' ],
},
'datasourceModule' : {
deps : [ 'jquery', 'backbone', 'models' ]
},
'store' : {
deps : [ 'backbone' ],
},
'testPagination' : {
deps : [ 'jquery' ]
},
// DESIGN
'bootstrap' : {
deps : [ 'jquery' ]
},
}
});
function loadPageNumbers() {
alert("Hi hi");
require([ "jquery", "testPaginationModule"],
function($, testPaginationModule) {
testPaginationModule.loadPagination(1000);
});
}