Yii Framework Forum: EchMultiSelect Widget - Yii Framework Forum

Jump to content

  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

EchMultiSelect Widget Simple Wrapper Widget for the jQuery UI MultiSelect Widget by Eric Hyn

#61 User is offline   pjravs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 23
  • Joined: 06-February 14

Posted 16 March 2014 - 11:19 PM

I have a problem with this widget.

If I close it, it does not show up again. I have to refresh the page to select again. What seems to be the problem?

And also, is there an option that it shows the text that has been selected thanks!
0

#62 User is offline   Thiago Arruda 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 27-May 14

Posted 27 May 2014 - 12:24 PM

This widget seems to be very helpful. However, I'm having an issue that once I open the list , I can't close it, not by clicking the select nor by the X button. Does anyone knows how to fix it?

I'm using Yii 1.1.14!
0

#63 User is offline   epulgaron 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 168
  • Joined: 19-February 14

Posted 25 June 2014 - 09:49 AM

I have tried to use this extension, but I several problems arise
1-not the dropdown closes when I choose an item
2-close button does not work me
3-when I give "insert" an element over my application throws me the error "field must be a number", the primary keys are integers and auto-increment

any idea?

View Postc@cba, on 28 March 2012 - 05:58 PM, said:

One possibility is the following:
you define a new attribute/variable in the model file, at the beggining, directly after the class starts:
class Car extends CActiveRecord {
   $colors = array();
   ...
}

The name of the variable should not be equal to a column name. Here, your model/table should not have a column named 'colors'. You then use this new attribute in the widget:
$this->widget('ext.widgets.EchMultiselect', array(
    'model' => $model,
    'dropDownAttribute' => 'colors',     
    'data' => $data,
});

In the controller file, you then have the array
$_POST['Cars']['colors']

that provides the id's of the clicked/selected colors for further use.

To handle the field_1,...,field_N columns:
You could build an array, like
$data = array('field_1',...,'field_N');

and use it as the data source in the widget above.
Then in the controller you can loop from 1 to N and check for each, if the correspondig box was selected and set the field_X accordingly. Something like:
if( in_array(X,$_POST['Cars']['colors']) ) $model->field_X = 1;
else $model->field_X = 0;


Otherwise, you would have to provide a separate checkbox for each of the field_X columns in your form. And to combine a set of checkboxes into a dropdown of checkboxes, I think we would need a different widget.

Best regards...

0

Share this topic:


  • (4 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users