AnsweredAssumed Answered

Unable to get the current record id from SubpanelListView

Question asked by Paul Carlton on May 1, 2015
Latest reply on Jun 14, 2017 by Autchara Chaiprom
I am unable to get the record id after creating a subpanel action button and setting a custom call on that button.  This button shows up for each contact.  The other action buttons work on each specific row, but this button DOES NOT.  I can not get the contact id this button is assigned to in the row from the subpanel list view.  What am I doing wrong?

In /custom/modules/Contacts/clients/base/view/subpanel-for-accounts/subpanel-for-accounts.php
'rowactions' => array(
'actions' => array(
  array(
   'type' => 'rowaction',     'icon' => 'icon-remove-circle',     'name' => 'record-set-main-contact',     'label' => 'Set As Main Contact',     'event' => 'list:editmain_c:fire',     'acl_action' => 'edit',    ),   ),  ),

In /custom/modules/Contacts/clients/base/view/subpanel-list/subpanel-list.js

({     extendsFrom: 'SubpanelListView',
   initialize: function(options){
      this._super('initialize', [options]);
      // this.bindDataChange();
      this.context.on('list:editmain_c:fire', this.mainContact, this);
   },

   mainContact: function(event) {

      console.log(this.model);
      console.log(this.collection);
      console.log(this.meta);
      console.log(this.module);
      console.log(this.model.id);
      console.log(this.context.id);

      /*app.api.call('GET', app.api.buildURL('Contacts/updateMainContact/'), null, {
         success: function(data) {
            console.log(data);
            if (data.success) {
               alert('will refresh page');
            }
         },
         error: function(error) {
            console.log(error);
         }
      });*/
   }
}) 


console.log(this.model.id) logs "undefined"
The only information I get is the collection of contacts, not the actual contact id that button pertains to.

Outcomes