Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Callback to capture any change on the toggle switch #16

Open
paribhandari opened this issue Sep 8, 2017 · 4 comments
Open

Callback to capture any change on the toggle switch #16

paribhandari opened this issue Sep 8, 2017 · 4 comments

Comments

@paribhandari
Copy link

Hi,

I want to capture the change of value on the Candlestick toggle switch. Which call back should i use? The afterAction and afterSetting both are invoked at the time of initialization itself.

Kindly suggest.

@EdouardTack
Copy link
Owner

Hi,

I think you can use afterSetting() callback. It's fired when the toggle change.

Edouard

@paribhandari
Copy link
Author

The after setting is getting initialized at the time of setup itself. Should i be calling it separately?
Currently i have set it up like this, is it correct?

$('#'+t).candlestick({
'mode': 'options', // "contents" is the other mode
'contents': { // Options for "contents" mode
'left': 'Left', // The left content
'middle': 'Middle', // The middle content
'right': 'Right', // The right content
'swipe': true // enable the global swipe mode
},
'on': '2', // for on value
'off': '1', // for off value
'nc': '0', // for none/default value
'swipe': true, // for swipe
'size': 'md', // Sizes (lg, md (default), sm, xs)
'debug': true, // Display some log message. used with Candlestick.log()
'allowManualDefault': true, // Enable the three options, set to false will disable the default option
afterSetting: function(input, wrapper, value) {
// Fired after setting value

   console.log(" afterSetting:: input : " + JSON.stringify(input) );
   var selector = input.selector;
   // if(selecto)
   var temp = [];
   temp = selector.split("-");
   console.log("temp[1] : " + temp[1] + " value : " + value );
   if(temp[1] !== undefined){
    self.benefitsTypeHot.setDataAtCell(temp[1],2,value);
  }
}

});

@EdouardTack
Copy link
Owner

afterSetting is used in candlestick initilization, and after, when "switch" is fired.
I think your code is okay.

@CatalinRadoi
Copy link

I have the same issue. Why is it called at initialization?? I need an event only called when the switch is fired, not on initialization! :((

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants