Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
define(['cbj', 'configbox/configurator'], function($, configurator) {
  
  var customType = {
    ..
    initEach: function() {
    
      $('.question.type-customtype').on('click', '.some-button', function() {
      
        let questionId = $(this).parent('.question').data('questionId');
        let selection = $(this).data('some-data-attribute');
        
        configurator.sendSelectionToServer(questionId, selection);
        
      });
     
    }
    ..
  }
  
  ...
  configurator.registerQuestionregisterQuestionType('customtype', customType);
  
});

...

Task name, essentially the public method’s name to call within name of a public method in your controller class.

data (Plain object or Array)

...

Code Block
languagejs
cbrequire(['configbox/server'], function(server) {

  server.injectHtml(target, controller, task, data, callback);
    
});

The framework will inject the HTML and in case the HTML contains a KenedoView, it’s JS initEach and initOnce methods will be called.

Parameters

target (String or jQuery Collection)

Provide either a CSS selector to your target element or a jQuery collection. The fetches HTML will be injected there.

controller (String)

Name of the controller to use. See KenedoController on how to add a custom controller to act as backend.

...