Topic: Ps is not defined

Rodriguez pro asked 5 years ago


Hello, I have a problem using mdb Sidenav, I am using webpack and after include the complete mdb.js file, I still getting the error message "Ps is not defined", but if I include the mdb.js file in the traditional form work perfectly, any help would be appreciate.

mistervac free answered 5 years ago


PS is simply a module for PerfectScrollbar. 

I could fix this by simply CDN

https://cdnjs.cloudflare.com/ajax/libs/jquery.perfect-scrollbar/1.4.0/perfect-scrollbar.min.js

and changed:

Ps.initialize(sideNavScrollbar);

to

const ps = new PerfectScrollbar(sideNavScrollbar);

Piotr Glejzer staff commented 5 years ago

Thanks for this workaround. Have a nice day.


cdenby pro answered 4 years ago


I think I found the solution in another thread: https://mdbootstrap.com/support/jquery/updgrade-to-4-8-0-pro/ This indicates that the Ps.initialize(el) is not to be used at all but replaced with the code: var ps=new PerfectScrollbar(el)


cdenby pro answered 4 years ago


I'm now seeing this in MDB Pro 4.12.0. I had this website working fine in 4.5.12 but when I upgraded to 4.12.0, suddenly I started getting the PS errors again. I've tried installing the Perfect Scrollbar, but it seems to have no effect. I suppose I don't have the workaround with the new installation sorted out properly. Please advise!


waynefulcher pro answered 5 years ago


I see it has been about 4 months since anyone has commented on this thread. I still have this issue with the latest version of MDB 4.7.7. Has there been any sort of fix or work-around yet?

Thanks


Piotr Glejzer staff commented 5 years ago

We upload perfect scrollbar to the latest version. Did you try this? Errors still the same?


kylescousin pro commented 5 years ago

I have the same issue

MD Pro 4.8.0


Bartłomiej Malanowski staff commented 5 years ago

@kylescousin, did you try to install perfect scrollbar as a separated node module? Here's the guide: https://github.com/utatti/perfect-scrollbar#install


Piotr Glejzer staff answered 5 years ago


Hi, Are you using our tutorial about webpack? Webpack Best, Piotr

Rodriguez pro commented 5 years ago

Hi,

Yes, plus another small changes, but the configuration is almost the same, the problem come when I include the mdb.js using the file directly on the web, I can see the window variable hold Ps property(window.Ps), but if I include the file using require or import, the window variable does not contain Ps object.

Here is an example of my code.

//Jquery library
import 'jquery';
//Bootstrap
import 'bootstrap';

//Common js for all pages
import './common'

import '../../vendors/mdb/js/mdb';

// SideNav Button Initialization
$(".button-collapse").sideNav();
var sideNavScrollbar = document.querySelector('.custom-scrollbar');
Ps.initialize(sideNavScrollbar);

Everythings works fine until Ps.Initialize(sideNavScrollbart) line.

 

 

 

 


Piotr Glejzer staff commented 5 years ago

hmm well maybe it will be not so much clever idea but did you try to use path without ../ like that :

import '../vendors/mdb/js/mdb';


cageq pro commented 5 years ago

laravel with the mdb pro also have the problem : 

using the webpack 

//require("mdbootstrap-pro");

so , mdb pro can't be required into ?

Piotr Glejzer staff commented 5 years ago

Well, it should be work. We will check it and fix it as soon as possbile. We are very sorry about that bugs. 


morgoth pro commented 5 years ago

Hi, have you fixed the "Ps" bug? I'm a Pro user using webpack (MDB Pro 4.5.14). Everything works like a charm. When I try to use the double-nav with Ps.initialize(...) I get that reference error.

If there is a way to get it to work, it should be appreciated a lot. Even with hardcoded solution for now is good enough because this is blocking deployment tasks.

thanks a lot


Piotr Glejzer staff commented 5 years ago

Hi.

we are very sorry but we didn't fix that problem yet. We have that problem in our 'bug list' but I recently moved it to 'priority bugs' so we will think more about that in next week. We are sorry again. Have a nice day.

Best,

Piotr


artur.karczmarczyk free commented 5 years ago

Hello, has the problem been solved? I recently purchased the Pro licence and I'm extremely dissatisfied with the quality of the software. On saturday I configured everything according to webpack tutorial, which disappeared on Monday only to appear again today. So now I followed the new tutorial from scratch only to learn that Ps bug exists still. When I follow the hint from below with using PerfectScrollbar(sideNavScrollbar) instead of Ps.initialize(), I still get just grayish overlay instead of the menu bar.


Piotr Glejzer staff commented 5 years ago

Did you try that workaround below? 



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.10
  • Device: Laptop
  • Browser: Chrome
  • OS: Ubuntu
  • Provided sample code: No
  • Provided link: No