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-09 15:37] – sbl | protogrid:create-button [2021-10-15 14:13] (current) – old revision restored (2018-03-02 10:26) dru | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== Button |
- | You can simply create your own button | + | 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: |
- | < | + | < |
+ | function guid() { | ||
function s4() { | function s4() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | return Math.floor((1 + Math.random()) * 0x10000) | ||
Line 12: | Line 13: | ||
return s4() + s4() + ' | return s4() + s4() + ' | ||
s4() + ' | s4() + ' | ||
- | } </ | + | } |
+ | </ | ||
- | This code-snippet creates a new Card-Id. Next you need to add the code to actually create your Card. For this, you need the key of the proto (see [[protogrid: | ||
- | Now you can add the following code snippet below the last one, replacing " | ||
- | < | + | This code snippet generates a new Card ID. Next you need to add the code which actually creates your Card. For this, you need to know the key of the [[protogrid: |
+ | Now you can add the following code snippet below the one above, replacing " | ||
+ | |||
+ | < | ||
function create_product(){ | function create_product(){ | ||
window.open("/" | window.open("/" | ||
Line 23: | Line 26: | ||
</ | </ | ||
- | Next, create a new [[protogrid: | + | |
- | < | + | Next, create a new [[protogrid: |
+ | < | ||
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 your Button will create and open a new Card! | + | |
+ | That's it, clicking onto this button will immediately create and open a new Card! | ||