initialxy / cordova-plugin-themeablebrowser

Fork of org.apache.cordova.inappbrowser in an attempt to make it a bit more themeable and configurable to add some custom actions.
Apache License 2.0
294 stars 221 forks source link

Add Menu Items Dynamically #123

Open Sonal824 opened 7 years ago

Sonal824 commented 7 years ago

Hello, this plugin works great for me in static data. but i want to make Menu items dynamic so i passed Json Object Data in menu items. but its not working. can you help me with it.

Here is my code: var items_html = []; items_html.push({event: "helloPressed" , label: "test1"}); items_html.push({event: "testPressed" , label: "test2"});

var this_b = cordova.ThemeableBrowser.open(url_to_open, '_blank', { customButtons: [ { image: 'ic_action_remove', imagePressed: 'close_pressed', align: 'right', event: 'closeactionPressed' }, ], menu: { image: 'ic_action_remove', imagePressed: 'menu_pressed', title: 'Test', cancel: 'Cancel', align: 'left', items: JSON.stringify(items_html) }, }).addEventListener('closeactionPressed', function(event) { this_b.close(); }).addEventListener('helloPressed', function(e) { alert('Add dynamic redirect url here'); }).addEventListener('testPressed', function(e) { alert('Add dynamic redirect url here'); });