AnsweredAssumed Answered

Redirect panel top + button on subpanel for an iframe

Question asked by sidhu sidhu on Jun 9, 2016

Hi All

 

           I have custom module related to the accounts.I have its subpanel under the accounts module.

I have a form and want to open the form when i click on the + button there in an iframe.i have currently kept an alert on clicking the + button.

Can any one please suggest how to display an iframe on clicking the + button on subpanel with source as my form.

 

This is where till i have progressed

 

/<>/custom/Extension/modules/Accounts/Ext/clients/base/layouts/subpanels/subpanels.php

 

<?php

$viewdefs['Accounts']['base']['layout']['subpanels'] = array (  'components' => array (

      array(

          'layout' => 'subpanel',

          'label' => 'LBL_T_TESTS_ACCOUNTS_1_FROM_T_TESTS_TITLE',

          'override_paneltop_view' => 'panel-top-for-accounts',

          'context' => array(

              'link' => 't_tests_accounts_1',

          ),

      ),

  ),

);

 

/<>/custom/modules/T_Tests/clients/base/views/panel-top-for-accounts/panel-top-for-accounts.php

<?php

 

 

$viewdefs['T_Tests']['base']['view']['panel-top-for-accounts'] = array(

    'type' => 'panel-top',

    'buttons' => array(

        array(

            'type' => 'actiondropdown',

            'name' => 'panel_dropdown',

            'css_class' => 'pull-right',

            'buttons' => array(

                array(

                    'type' => 'sticky-rowaction',

                    'icon' => 'fa-plus',

                    'name' => 'custom_button',//changed this 'name' => 'create'

                    'label' => ' ',

                    'acl_action' => 'create',

                    'tooltip' => 'LBL_CREATE_BUTTON_LABEL',

                ),

                array(

                    'type' => 'link-action',

                    'name' => 'select_button',

                    'label' => 'LBL_ASSOC_RELATED_RECORD',

                ),

                array(

                    'type' => 'link-action',

                    'name' => 'custom_button',

                    'label' => 'Custom Button',

                ),

            ),

        ),

    ),

);

 

 

/<>/custom/modules/T_Tests/clients/base/views/panel-top/panel-top.js

 

({

        className: 'subpanel-header',

 

 

    /**

     * @inheritDoc

     */

    attributes: {

        'data-sortable-subpanel': 'true'

    },

 

 

    /**

     * @inheritDoc

     */

    events: {

        'click': 'togglePanel',

        'click a[name=create_button]:not(".disabled")': 'createRelatedClicked',

        'click [name="custom_button"]': 'spinCube',

    },

  

    spinCube:function(){

 

  //this.$el.html('<iframe src="https://www.google.co.in/"></iframe>');//i want this

   

 

  alert("hello world");//my alert

 

  },

  

 

 

    plugins: ['LinkedModel', 'Tooltip'],

 

 

    /**

     * @inheritDoc

     */

    initialize: function(options) {

        // FIXME: SC-3594 will address having child views extending metadata

        // from its parent.

        options.meta = _.extend(

            {},

            app.metadata.getView(null, 'panel-top'),

            app.metadata.getView(options.module, 'panel-top'),

            options.meta

        );

 

 

        this._super('initialize', [options]);

 

 

        // This is in place to get the lang strings from the right module. See

        // if there is a better way to do this later.

        this.parentModule = this.context.parent.get('module');

    },

 

 

    /**

     * Event handler for the create button.

     *

     * @param {Event} event The click event.

     */

    createRelatedClicked: function(event) {

        this.createRelatedRecord(this.module)

    },

 

 

    /**

    * Event handler that toggles the subpanel layout when the SubpanelHeader is

    * clicked.

    *

    * Triggers the `panel:toggle` event to toggle the subpanel.

    *

    * @param evt The `click` event.

    */

    togglePanel: function(evt) {

        if (_.isNull(this.$el)) {

            return;

        }

 

 

        var $target = this.$(evt.target),

            isLink = $target.closest('a, button').length;

 

 

        if (isLink) {

            return;

        }

 

 

        if (!this.layout.disposed) {

            this.layout.toggle();

        }

    }

})

Outcomes