Code Monkey home page Code Monkey logo

eselect2's People

Contributors

anggiaj avatar bjoernakamanf avatar bravoman avatar dudareviv avatar gabrieljenik avatar ilyapoz avatar kingyes avatar nineinchnick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

eselect2's Issues

License

Nice work! But I can't seem to find any licensing information for this code/project. Is that something you can add?

Select2 not storing ID

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);
    }

Select2

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.

data ignored when used a selector

<?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' ?

CListView pagination unable to load Eselect2

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);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.