Adminlte: Error init Layout via jquery

Created on 12 Dec 2019  路  4Comments  路  Source: ColorlibHQ/AdminLTE

$('body').Layout('init');

ERROR TypeError: data[config] is not a function
at HTMLBodyElement. (adminlte.js:449)
at Function.each (jquery-3.4.1.min.js:2)
at k.fn.init.each (jquery-3.4.1.min.js:2)
at k.fn.init._jQueryInterface [as Layout] (adminlte.js:438)
at LoginComponent.ngOnInit (login.component.ts:33)
at checkAndUpdateDirectiveInline (core.js:31910)
at checkAndUpdateNodeInline (core.js:44367)
at checkAndUpdateNode (core.js:44306)
at debugCheckAndUpdateNode (core.js:45328)
at debugCheckDirectivesFn (core.js:45271)

js bug 3.x

All 4 comments

I solved the error by modifying the script in my case was the Layout but note that this error can occur in other components such as ControlSidebar.

In the definition of the Layout to be more specific where the method is defined I made the following modification:
if (config === 'init') {
data ['_' + config] ();
}

The error is that it does not find the init method since it is declared as _init for this reason it generates errors and there other components in which the same scenario is presented

Thanks for reporting this issue, I've fixed it in master repo and added a way to use it without specifing the method (init) like this $('body').Layout();.

hello thank you very much just as a suggestion it would be good to apply the init also the other plugin
Since I still use Treeview ('init');
and it would be nice just to place the parentheses
CardRefresh
Card widget
ControlSidebar
DirectChat PushMenu
Toasts
TodoList;
Treeview;

That's a nice suggestion, I've added a note on the v3.1.0 project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lenamtl picture lenamtl  路  3Comments

jrlooney picture jrlooney  路  3Comments

gaea44 picture gaea44  路  3Comments

frlinw picture frlinw  路  3Comments

fromberg100 picture fromberg100  路  4Comments