Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
protogrid:create-button [2017-11-13 11:04] – pgrid_wiki_admin | protogrid:create-button [2021-10-15 14:13] (current) – old revision restored (2018-03-02 10:26) dru | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== Button |
- | This article explains how to add own buttons which create new [[protogrid: | + | This article explains how to add own buttons which create new [[protogrid: |
- | First, add the necessary code. To do this, add a new [[protogrid: | + | First, add the necessary code. To do this, add a new [[protogrid: |
<code javascript> | <code javascript> | ||
function guid() { | function guid() { | ||
Line 16: | Line 16: | ||
</ | </ | ||
- | <code ecmascript> | ||
- | function guid() { | ||
- | function s4() { | ||
- | return Math.floor((1 + Math.random()) * 0x10000) | ||
- | .toString(16) | ||
- | .substring(1); | ||
- | } | ||
- | return s4() + s4() + ' | ||
- | s4() + ' | ||
- | } | ||
- | </ | ||
- | This code snippet | + | This code snippet |
Now you can add the following code snippet below the one above, replacing " | Now you can add the following code snippet below the one above, replacing " | ||
Line 37: | Line 26: | ||
</ | </ | ||
- | <code ecmascript> | ||
- | function create_product(){ | ||
- | window.open("/" | ||
- | } | ||
- | </ | ||
- | Next, create a new [[protogrid: | + | Next, create a new [[protogrid: |
<code javascript> | <code javascript> | ||
create_product(); | create_product(); | ||
</ | </ | ||
- | As the last step, add a button to the [[protogrid: | + | As last step, add a button to the [[protogrid: |
- | + | ||
- | That's it, clicking onto this Button will immediately create and open a new Card! | + | |
+ | That's it, clicking onto this button will immediately create and open a new Card! | ||