API for editor - Window

Create the button, triggering

Layout

Open a new window

new Window("#id_bouton",  {
   title: "Window title",
   height: 550
  }, 
  function(layout, attr) {

});

The default dimensions are applied to the window but the parameters height and width can assign new dimensions. The identifier given parameter is the same as the release button. Thus, it can assign the button to the window. When the user clicks the button, the window opens.

height can be set to auto to the window takes the full height of the window.

Send data to the window

The attr object with the data to be used in the window. Must release button has the attribute data-window with a value JSON. In the DOM, this will represent by :

<button id='my_button' data-window='{"value":1}'>Open</button>

In the window, you can then retrieve the value :

console.log(attr.value)

If you want to retrieve data outside the trigger button, use the data :

new Window("#id_bouton",  {
   title: "Titre Fenêtre",
   height: 550,
   data: function() {
     return $(this).parent();
   }
  }, 
  function(layout, attr) {

});

The cleanness data is a function returning the page element with the attribute data-window. Use the jQuery API to manipulate the DOM.

Confirmation window

A confirmation window is composed of text and two buttons: OK and Cancel. It is used to confirm an action such as deleting a given.

new WindowConfirm("#id_bouton",  {
   text: "Are you sure ?"
  }, 
  function(data, e) {

});

Properties are the same as the Window. When the user clicks OK, the window closes and executes the function code above. The data is the attribute value data-window trigger button

No trigger button

If the trigger button is not present, you can create a dummy. Use the trigger :

new Window("#id_bouton",  {
   title: "Window title",
   trigger: true
  }, 
  function(layout, attr) {

});

Then open the window by calling the trigger :

$("#id_bouton").trigger("click");

Full windows API

You can retrieve the windows API :

var my_window = new Window("#id_bouton",  {
    width: 400
  }, 
  function(layout, attr) {

});
my_window.setTitle("Titre");

Methods

setContent(html)

Assigns the HTML content

getContent()

Retrieves the element jQuery content

getButtonsBottom()

Retrieves the element jQuery with the buttons at the bottom of the window

getWindow()

Retrieves the element jQuery window

setIndexMask()

Assigns the superposition of the mask behind the window by positioning the current window

getIndexMask()

Retrieves the superposition of the mask behind the window

refresh()

Refreshes the window

clear()

Clears the contents of the window

remove()

Removes the window

close()

Close the window

setTitle(text)

Sets the window title