Grisza Grisza - 6 months ago 3
Javascript Question

How does it work the argument buttonIndex in cordova-plugin-dialogs?

Hi I have problem with setting

if (buttonIndex == 1) {
//do stuff
} else if (buttonIndex == 2) {
//II do stuff

so is the app knows about buttonIndex in
? Whether it knows only in
function onConfirm(buttonIndex){}

about buttonIndex?
Generally is it about confirm dialog this dialog works but only display info
when clicked 'Tak' so buttonIndex == 1 (Tak is in English Yes) then I want to append
with name chipsy(in English chips) and a button to
this doesn't work
here is my code

It is an issue with appending or with buttonIndex?


solved it was an issue with wrong sequence of function 'content'

The right order

function onConfirm(buttonIndex) {
                                if (buttonIndex == 1) {

                                    var li = $('<li/>');
                                    var lv = $('#lv');
                                    var divP = $('<div/>', {
                                    var divC1 = $('<div/>', {
                                    var btnDel = $('<button/>', {
                                                 'class':"ui-btn ui-icon-delete ui-btn-icon-notext ui-btn-inline",
                                                 click: function() {

                                    var divC2 = $('<div/>', {


                                    window.plugins.toast.showLongBottom('Added chips to shopping list');
                                } else if (buttonIndex == 2) {
                                    window.plugins.toast.showLongBottom('Not added');

                            navigator.notification.confirm('Do you want to add chips to beer?', onConfirm, 'Basket Analysis', ['Yes','No']);