anggiaj / eselect2 Goto Github PK
View Code? Open in Web Editor NEW(DEPRECATED - Unmaintaned) ESelect2 is a widget extension for Yii framework. This extension is a wrapper for Select2 Jquery plugin (https://github.com/ivaynberg/select2).
(DEPRECATED - Unmaintaned) ESelect2 is a widget extension for Yii framework. This extension is a wrapper for Select2 Jquery plugin (https://github.com/ivaynberg/select2).
Nice work! But I can't seem to find any licensing information for this code/project. Is that something you can add?
before 3.4.2, this class was removed on focus lost.
I am using this class to show a hilighted border on focus, but now, its never reset.
Hi All,
I am using select2 extension. But when trying to save (create) record even though I select from the list, it gives the error "Teilnehmer cannot be blank."
View:
$this->widget('ext.select2.ESelect2', array(
'model'=>$model,
'attribute' => 'cTeilnehmerID',
'data'=>CHtml::listData(Teilnehmer::model()->findAll(),'cTeilnehmerID','fullName'),
'options'=>array(
'width'=>'300px',
'placeholder'=>' -- please select -- ',
'sourceUrl'=>array('buchung/autoComplete'),
)
));
Controller:
public function actionAutoComplete() {
$criteria = new CDbCriteria;
$criteria->select = array('cTeilnehmerID','cVorname','cNachname');
$criteria->addSearchCondition('cVorname', strtoupper( $_GET['term']) ) ;
$criteria->addSearchCondition('cNachname', strtoupper ( $_GET['term']), true, 'or');
$criteria->addSearchCondition('CONCAT(cVorname," ",cNachname)', strtoupper ( $_GET['term']), true, 'or');
$criteria->limit = 15;
$data = Teilnehmer::model()->findAll($criteria);
$res = array();
foreach ($data as $item) {
$res[] = array(
'id' => $item->cTeilnehmerID,
'value' => $item->fullName,
'label' => $item->fullName,
);
}
echo CJSON::encode($res);
}
Hello, I created an extension for Select2 Igor Vaynberg some time now, but I decided to send the Yii site just now and saw that you already have an extension there.
We could join our efforts and make only an extension.
http://www.yiiframework.com/extension/yiiselect2
Sorry, my English is not very good.
<?php echo $form->textField($model,'Nome_Cliente',array('class'=>'form-control')); ?>
<?php $this->widget('ext.select2.ESelect2',array(
'selector' => 'INPUT#OrdiniCaricati_Nome_Cliente',
'data' => $model->clientList,
'options' => array (
'width' => 'resolve',
'createSearchChoice' => 'function(term) {
return {
id : term,
text : term
};
},'
)
)); ?>
In this case, I got this generated javascript:
jQuery('INPUT#OrdiniCaricati_Nome_Cliente').select2({
'formatNoMatches': function () {
return "Nessuna corrispondenza";
},
'formatInputTooShort': function (input, min) {
return "Inserisci altri " + (min - input.length) + " caratteri";
},
'formatInputTooLong': function (input, max) {
return "Inserisci " + (input.length - max) + " characters in meno";
},
'formatSelectionTooBig': function (limit) {
return "Puoi selezionare solo " + limit + " voce/i";
},
'formatLoadMore': function (pageNumber) {
return "Caricamento...";
},
'formatSearching': function () {
return "Ricerca in corso...";
},
'width': 'resolve',
'createSearchChoice': function (term) {
return {
id: term,
text: term
};
}
});
});
This is a valid way to use Select2, because you cannot use Select2 with createSearchChoice.
So why the extension ignore 'data' ?
Just a small thing: can you update to latest tag of select2?
And, please, do it keeping the locales
Hello,
I am trying to use ESelect2 in Clistview, On page load it works however after pagination it's not working please advice.
My Code:
echo CHtml::textField("Task[$data->id]",implode(",",$displayUsers),array(
'id'=>'Task_'.$data->id,
'class' => 'form-control input-md',
'ajax' => array(
'type' => 'POST',
'url' => Yii::app()->createAbsoluteUrl('task/taskassigneeupdate'),
'data' => array('task_assignee_ids' => 'js:this.value','id' => $data->id),
'success' => 'function(data){
statusUpdateMessage();
}',
)
));
$this->widget('ext.select2.ESelect2', array(
'selector' => '#Task_'.$data->id,
'options' => array(
'placeholder' => 'Select Users',
'width' => '100%',
'allowClear' => false,
'multiple' => 'multiple',
'options' => $TaskAssign,
'minimumInputLength' => 1,
'data-id' => $data->id,
'ajax' => array(
'url' => $this->createUrl('user/listjson',array('service_division_id'=>$data->TaskType->service_division_id)),
'dataType' => 'jsonp',
'data' => 'js: function(term,page) {
return {
q: term,
page_limit: 10,
};
}',
'results' => 'js: function(data,page){
return {results: data.users};
}',
),
'formatResult' => 'js:function(users){
return users.title;
}',
'formatSelection' => 'js: function(users) {
return users.title;
}',
'initSelection' => 'js:function(element,callback) {
data = '.CJSON::encode($returnData).';
callback(data.users);
}',
),
),true);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.