Jump to content

Problem with VEX dialog in custom module


androbey
 Share

Recommended Posts

Hi everybody,

I am currently developing a configurable module (no ProcessModule).

Some time ago I stumbled upon a forum post about using the VEX library in the backend. 

 

 Now, I wanted to try this in my module. But with the example code I get an almost useless dialog: 

<?php
//in init method
$this->modules->get('JqueryUI')->use('vex');
//javascript
ProcessWire.confirm('Are you sure you want to continue?', function() {
  //ok
},function() {
  // canceled
});

leads to following screen: 

vex-pw.thumb.PNG.cbb47384a7e5d36acb0da0b266690fe6.PNG

There are no erros in console. I am using ProcessWire 3.0.148.
Did I miss something or doing something wrong?
 

Link to comment
Share on other sites

It should work exactly like you said. Did you maybe not define a success callback? Then it would fallback to a regular confirm (though your screenshot does not like like a regular confirm...). https://github.com/processwire/processwire/blob/51629cdd5f381d3881133baf83e1bd2d9306f867/wire/templates-admin/scripts/main.js#L471

Check if "vex" is defined in your devtools console. There you can also try to show a vex alert like this: ProcessWire.alert('test');

Maybe your module is just not loaded?

Link to comment
Share on other sites

Ok I found the reason why my modal does not really look like it should but I don't know why the condition is not met: 

https://github.com/processwire/processwire/blob/master/wire/modules/Jquery/JqueryUI/JqueryUI.module#L44 

$adminTheme obviously does not evaluate to true, hence the vex theme is not set. But as I am in admin backend, it should evaluate to true, shouldn't it?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...