Yii Framework Forum: Typeahead Field With Option And Value Like Select Field - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Typeahead Field With Option And Value Like Select Field

#1 User is offline   venuk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 15-February 13

Posted 21 November 2013 - 06:04 AM

I am trying to migrate Yii1.X to Yii2

What are the options in Yii2 to create ajax dropdownlist?
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,780
  • Joined: 17-January 09
  • Location:Russia

Posted 21 November 2013 - 06:08 AM

What is ajax dropdownlist?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   venuk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 15-February 13

Posted 21 November 2013 - 06:19 AM

For ex:
In Yii1. I have used select2 extension like below to populate a dropdown
<?php echo $form->select2Row($model, 'country_name', array(
'asDropDownList' => false,
'options' => array(
'closeOnSelect' => false,
'placeholder' => 'Select Country',
'allowClear' => true,
'ajax' => array(
'url' => CController::createUrl('user/ajaxgetcountry'),
'dataType' => 'json',
'data' => 'js:function(term,page) { return {q: term, page_limit: 10, page: page}; }',
'results' => 'js:function(data,page) { return {results: data}; }',
),
)));
?>

But I want to know how to migrate it to Yii2
0

#4 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,780
  • Joined: 17-January 09
  • Location:Russia

Posted 21 November 2013 - 06:31 AM

Well, you can either port it to Yii2 or write some custom JavaScript.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#5 User is offline   venuk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 15-February 13

Posted 21 November 2013 - 08:13 PM

Thanks.
0

#6 User is offline   venuk 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 25
  • Joined: 15-February 13

Posted 26 November 2013 - 02:47 PM

I have found that We can use typeahead.js to work smootholy with all kinds ajax calls in yii.

but typeahead is not like select field.

When I select an option from displayed options, I actually want to select its actual value like SELECT field.

Does any one know how to do it?
0

Share this topic:


Page 1 of 1
  • 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