Welcome to the Protogrid Developer Wiki. A place to gather all the documentation and tips&tricks regarding Protogrid.

Create New Card Via Link

Imagine you need to check if a certain Card for a given Proto exists and if not you want to redirect the user to crate a new Card. To do so, you first need to create a new Card-Key (example in javascript)

function generate_key()
{
    //helper functions to generate random strings of length 4
    function s4() 
    {
    return Math.floor((1 + Math.random()) * 0x10000)
      .toString(16)
      .substring(1);
    }
    return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
        s4() + '-' + s4() + s4() + s4();
}

Using this function you can now move on and redirect the user to create a new card based on a given proto

//specify the parent proto in proto_key
function create_new_card(proto_key)
{
    let url = '/' + $APP_URL_NAME + '/' + generate_key() + '?action=open_new_card&proto_key=' + proto_key;
    window.open(url, '_self');
}
Print/export