AdminLTE icon indicating copy to clipboard operation
AdminLTE copied to clipboard

Uncaught TypeError: Cannot read property 'options' of undefined

Open kaynewilder opened this issue 11 years ago • 20 comments

My sidebar is broken.The menu doesn't seem to dropdown. I inspected element and found this error:

Uncaught TypeError: Cannot read property 'options' of undefined

I have read similar problems but I can't seem to find the answer to mine.

kaynewilder avatar Feb 25 '15 06:02 kaynewilder

You are going to have to give a little more details to your problem. Where does that problem occur? Which JS file produced this error? Which version of AdminLTE are you using? Any other information that you can place here will help us help you. Thanks.

almasaeed2010 avatar Feb 25 '15 14:02 almasaeed2010

Hi. I was using this: https://github.com/almasaeed2010/AdminLTE and the problem occurs when I load my index page, the side nav is broken, like the submenus are showing already and also the charts are not visible, it's just blank space. But anyway, I have found an alternate solution. I have used the asset bundle instead and now it is working fine.

kaynewilder avatar Feb 26 '15 01:02 kaynewilder

Hi I am having this same issue. I am using AdminLTE-2.0.3. Any help would be super, as I cannot seem to find the problem. COuld you please help?

This error seems to be occuring in app.js, when we are trying to retrieve the options of adminLTE object. (line 128: var o = $.AdminLTE.options;)

Please note: I am trying to use this with meteorJS.

Error details Uncaught TypeError: Cannot read property 'options' of undefined app.js?6e718cf14bb55f1e3752044b0e79a4027a4b22f6:128 (anonymous function)jquery.js:3143 jQuery.Callbacks.firejquery.js:3255 jQuery.Callbacks.self.fireWithjquery.js:3467 jQuery.extend.readyjquery.js:3498 completed

theroadrunnershow avatar Mar 15 '15 18:03 theroadrunnershow

I had this error and found that by moving my script reference from the to right before the closing body tag resolved my issue.

Seany84 avatar Aug 15 '15 11:08 Seany84

I am facing the same issue. But my script tags are before body only. I'm using sailsjs and when i view this file as starter.ejs through any route, this issue comes. But when i open the starter.html simply, this issue is not there. Issue is at app.js 151, says undefined.

iamvajid avatar Aug 17 '15 10:08 iamvajid

I had this too. Some script are interrupting. The script need to be the last one script to run. Move right before the closing body like Seany84 said.

pheliperocha avatar Oct 26 '15 15:10 pheliperocha

Adding for reference: I had this issue was well. Make sure none of your scripts are duplicated, I accidentally copied the JQuery 2.1.4 script in 2 different spots (made it harder to spot) and this caused the error.

stringsanbu avatar Jan 08 '16 09:01 stringsanbu

Make sure to require "jQuery-2.1.4.min" before adminlte app javascript. That's how I solved it.

lfaire avatar Jan 20 '16 01:01 lfaire

For anyone using Rails. I had added the jquery gem and also had jquery linked at the bottom of my application layout html. (I copied and pasted my old template :( )

Just make sure if you are using jquery gem you dont need to link jquery again.

removing the jquery link solved my problem.

bchellingworth avatar Apr 02 '16 16:04 bchellingworth

use app.js instead of app.min.js and remove the following code

$.AdminLTE = {};

/* --------------------

  • - AdminLTE Options -

  • Modify these options to suit your implementation */ $.AdminLTE.options = { //Add slimscroll to navbar menus //This requires you to load the slimscroll plugin //in every page before app.js navbarMenuSlimscroll: true, navbarMenuSlimscrollWidth: "3px", //The width of the scroll bar navbarMenuHeight: "200px", //The height of the inner menu //General animation speed for JS animated elements such as box collapse/expand and //sidebar treeview slide up/down. This options accepts an integer as milliseconds, //'fast', 'normal', or 'slow' animationSpeed: 500, //Sidebar push menu toggle button selector sidebarToggleSelector: "[data-toggle='offcanvas']", //Activate sidebar push menu sidebarPushMenu: true, //Activate sidebar slimscroll if the fixed layout is set (requires SlimScroll Plugin) sidebarSlimScroll: true, //Enable sidebar expand on hover effect for sidebar mini //This option is forced to true if both the fixed layout and sidebar mini //are used together sidebarExpandOnHover: false, //BoxRefresh Plugin enableBoxRefresh: true, //Bootstrap.js tooltip enableBSToppltip: true, BSTooltipSelector: "[data-toggle='tooltip']", //Enable Fast Click. Fastclick.js creates a more //native touch experience with touch devices. If you //choose to enable the plugin, make sure you load the script //before AdminLTE's app.js enableFastclick: false, //Control Sidebar Options enableControlSidebar: true, controlSidebarOptions: { //Which button should trigger the open/close event toggleBtnSelector: "[data-toggle='control-sidebar']", //The sidebar selector selector: ".control-sidebar", //Enable slide over content slide: true }, //Box Widget Plugin. Enable this plugin //to allow boxes to be collapsed and/or removed enableBoxWidget: true, //Box Widget plugin options boxWidgetOptions: { boxWidgetIcons: { //Collapse icon collapse: 'fa-minus', //Open icon open: 'fa-plus', //Remove icon remove: 'fa-times' }, boxWidgetSelectors: { //Remove button selector remove: '[data-widget="remove"]', //Collapse button selector collapse: '[data-widget="collapse"]' } }, //Direct Chat plugin options directChat: { //Enable direct chat by default enable: true, //The button to open and close the chat contacts pane contactToggleSelector: '[data-widget="chat-pane-toggle"]' }, //Define the set of colors to use globally around the website colors: { lightBlue: "#3c8dbc", red: "#f56954", green: "#00a65a", aqua: "#00c0ef", yellow: "#f39c12", blue: "#0073b7", navy: "#001F3F", teal: "#39CCCC", olive: "#3D9970", lime: "#01FF70", orange: "#FF851B", fuchsia: "#F012BE", purple: "#8E24AA", maroon: "#D81B60", black: "#222222", gray: "#d2d6de" }, //The standard screen sizes that bootstrap uses. //If you change these in the variables.less file, change //them here too. screenSizes: { xs: 480, sm: 768, md: 992, lg: 1200 } };

paste the above code below

$(function () { "use strict";

it works me

veerabiz1 avatar Aug 16 '16 12:08 veerabiz1

facing same problem admin_error

Copied and paste your solution but still have same problem

deepaksaini143 avatar Dec 24 '16 12:12 deepaksaini143

I'm also facing same issue when I use following for print functionality in master page:

Left menus are not working .

diptidsheth avatar Jan 12 '17 19:01 diptidsheth

Hi , Anybody tried AdminLTE with Angular ? I tried initializing the sidebar push menu as below in one of my components. Everything is bundled in vendor.js in order 1. Jquery, 2. app.js

var o = $.AdminLTE.options;

    //Activate sidebar push menu
    if (o.sidebarPushMenu) {
        $.AdminLTE.pushMenu.activate(o.sidebarToggleSelector);
    }

I get the following error ORIGINAL EXCEPTION: Cannot read property 'options' of undefined. I tried to check if it is even getting the AdminLTE object its undefined as well. How should I make it available to Jquery ($ ) any insight would help. p.s When I click on hamburger it simply goes to home page Update: I loaded them separately and it didnt help

rjankathi avatar Mar 15 '17 19:03 rjankathi

I had the same problem like @kaynewilder and the comment from @veerabiz1 solved this problem!

Phil795 avatar Apr 05 '17 11:04 Phil795

I resolved! The app.min.js calls jquery automatically... if you call another jqyery you will the same problem.

wladneto avatar Aug 02 '17 03:08 wladneto

In my code I replace '$' with 'jQuery' and my problem solved

skyview059 avatar Oct 25 '17 09:10 skyview059

I was having this problem with jQuery, having AdminLTE and Vue.js involved, in a Laravel framework. It was because i had the bootstrap.js loading too low on the chain, i had to move that to the top, before my vendors. .

Problem is most likely due to sequence of linking app.js, please load it after loading all JS files

2root2 avatar Feb 24 '18 14:02 2root2

I delete in datatable.min.js the JQuery v3.3.1 to work with version that is already there in AdminLTE template

bdpadrino avatar Mar 06 '19 13:03 bdpadrino

  1. Where you are including scripts, use app.js instead of app.min.js
  2. On line 144 remove $(function () { and on line 228 remove });
  3. Done!! conflict

shobhitk8055 avatar Sep 21 '20 11:09 shobhitk8055