AnsweredAssumed Answered

Alert message or change color on clicking a div(color boxes) in custom dashboard

Question asked by sidhu sidhu on Mar 16, 2016

Hi

 

i want to put an alert a message or change color on clicking the color boxes i have created here on my custom dashboardsd in accounts module.Shijin KrishnaAjay Kumar

But no event triggers on mycustom dashboards.

Can any one please help me with this.

 

/<>/clients/base/views/verificationsDashboard/verificationsDashboard.php

<?php

 

$viewdefs['base']['view']['verificationsDashboard'] =array(

    'dashlets' => array(

  array(

            'label' => 'Verifications',

            'description' => 'Verifications',

            'config' => array(

               'limit' => '3',

           

            ),

            'preview' => array(

               'limit' => '3',

           

            ),

             'filter' => array(

                'module' => array(         

                    'Accounts',

                ),

                'view' => array ('record')

            ),

 

   ),

 

  ),

);

 

/<>/clients/base/views/verificationsDashboard/verificationsDashboard.hbs

<div id="dashlet_content">

 

</div>

 

/<>/clients/base/views/verificationsDashboard/verificationsDashboard.js

 

({

 

plugins: ['Dashlet'],

 

    initialize: function(options) {

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

 

onclickChild:function(){
alert("hi testing");
},

    render: function(){

var accountNumber=this.model.get('acc_no_c');
//jQuery('#accountNumber').text(accountNumber);
console.log('accountNumber '+accountNumber);
var accountName=this.model.get('name');
//jQuery('#accountName').text(accountName);
console.log('accountName '+accountName);
var accountEmail=this.model.get('email');
$.each(accountEmail, function() {
var key = Object.keys(this)[0];
var value = this[key];
accountEmail=value;
});
//jQuery('#accountEmail').text(accountEmail);
console.log('accountEmail '+accountEmail);
var accountPhone=this.model.get('phone_office');
//jQuery('#accountPhone').text(accountPhone);
console.log('accountPhone '+accountPhone);
var accountMeter=this.model.get('meter_no_c');
//jQuery('#accountMeter').text(accountMeter);
console.log('accountMeter '+accountMeter);
var firstName=this.model.get('first_name_c');
var surName=this.model.get('surname_c');
//console.log('Name '+firstName+" "+surName)
//jQuery('#perons_name').text(firstName+" "+surName);
var str='<table><tr><th width="33px">Question</th><th width="33px">Expected Response</th><th width="33px"></th></tr><tr><td>Account Number</td><td >'+accountNumber+'</td><td align="center" style="text-align:center;"><div class="colorBox" id="accountNumber"  style="text-align:center;height:10px;width:10px;background-color:red"></div></td></tr><tr><td>Email Address</td><td >'+accountEmail+'</td><td align="center" style="text-align:center;"><div class="colorBox"  id="accountEmail" style="text-align:center;height:10px;width:10px;background-color:red"></div></td></tr><tr><td>Meter Number</td><td >'+accountMeter+'</td><td align="center" style="text-align:center;"><div  id="accountMeter" class="colorBox"  style="text-align:center;height:10px;width:10px;background-color:red"></div></td></tr><tr><td>Telephone Number</td><td >'+accountPhone+'</td><td align="center" style="text-align:center;"><div id="accountPhone" class="colorBox"  style="text-align:center;height:10px;width:10px;background-color:red"></div></td></tr><tr><td>Account Name</td><td >'+accountName+'</td><td align="center" style="text-align:center;"><div   id="accountName" class="colorBox" style="text-align:center;height:10px;width:10px;background-color:red"></div></td></tr><tr><td>Person Managing Account</td><td >'+firstName+" "+surName+'</td><td align="center" style="text-align:center;"><div id="perons_name" class="colorBox" style="text-align:center;height:10px;width:10px;background-color:red"></div></td></tr><tr align="center"><td></td><td><button id="verification_button">Submit</button></td><td></td></tr></table>';
jQuery('div.dashlet-content').html(str);
this.model.on('click .colorBox',this.onclickChild,this);

    }

})

Outcomes