-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
bugSomething isn't workingSomething isn't working
Description
My widget is working fine but when i am using select2 with the tabularEvents in the "STEP_TYPE_TABULAR" then getting the following error.
Setting unknown property: yii\bootstrap\ActiveField::tabularEvents
here its my code...
$step1 =[
'model' => $mymodel,
//set step type to tabular
'type' => FormWizard::STEP_TYPE_TABULAR,
'fieldConfig' => [
'content_support_title' => [
'widget' => Select2::class,
'containerOptions' => [
'class' => 'form-group'
],
'options' => [
'data' => ArrayHelper::map(\backend\modules\smedb\models\domains::find()->limit(50)->all(), 'id', 'expertise', 'domain'),
'options' => [
'class' => 'form-control'
],
'theme' => Select2::THEME_BOOTSTRAP,
'pluginOptions' => [
'allowClear' => true,
'placeholder' => 'Select domain'
]
],
//set tabular events for select2 fix which doesnot work correctly after cloning
'tabularEvents' => [
'beforeClone' => "function(event, params){
//fix for select2 destroy the plugin
let element = $(this);
element.select2('destroy');
}",
"afterClone" => "function(event, params){
//bind select2 again after clone
let element = $(this);
let elementId = $(this).attr('id');
let dataKrajee = eval(element.data('krajee-select2'));
let dataSelect2Options = element.data('s2-options');
$.when(element.select2(dataKrajee)).done(initS2Loading(elementId, dataSelect2Options));
}",
"afterInsert" => "function(event,params){
//initialize the options for the select2 after initializing
let selectElement = $(this).find('.field-shoottag-'+params.rowIndex+'-tag_id > select');
let dataKrajee = eval(selectElement.data('krajee-select2'));
//update the dataset attribute to the
if (typeof selectElement[0].dataset.select2Id !== 'undefined') {
//get the old dataset which has the old id of the input the select2 is bind to
let oldDataSelect2Id = selectElement[0].dataset.select2Id;
//delete the old dataset
delete selectElement[0].dataset.select2Id;
//add the new dataselect pointing to the new id of the cloned element
let newDataSelect2Id = oldDataSelect2Id.replace(
/\-([\d]+)\-/,
'-' + parseInt(params.rowIndex) + '-'
);
//add the new dataset with the new cloned input id
selectElement[0].dataset.select2Id= newDataSelect2Id;
}
selectElement.select2(dataKrajee);
}"
]
]
]
];`
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working