简体   繁体   中英

Javascript - Open an URL in a new tab by clicking a button

 {
     text: 'Berkas',
     align: 'center',
     cell: {

         xtype: 'button',
         dataIndex: 'file_kp_prodi_mhs',
         text: 'View',
         handler: function(button, e) {
             window.open(file_kp_prodi_mhs);
         },

     }
 }

Try this(change out vg.no with what you want):

<div href="https://www.vg.no" onclick="openInNewTab('https://www.vg.no')">Something To Click On</div>
    <script>
        function openInNewTab(url) {
            var win = window.open(url);
        win.focus();
        }
    </script>

You should get value from record like:

 {
     text: 'Berkas',
     align: 'center',
     cell: {
         xtype: 'button',
         dataIndex: 'file_kp_prodi_mhs',
         text: 'View',
         handler: function(button, e) {
             window.open(e.record.get(button.dataIndex));
         },
     }
 }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM