Yii Framework Forum: Yii - What To Pass As An Argument When Key-Value Pair Is Used In Yii Extension Ext.combobox.ejuicombobox - Yii Framework Forum

Jump to content

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

Yii - What To Pass As An Argument When Key-Value Pair Is Used In Yii Extension Ext.combobox.ejuicombobox Rate Topic: -----

#1 User is offline   Rudra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 118
  • Joined: 12-July 13

Posted 16 November 2013 - 12:35 AM

Now , I created two dropdownlists (min and max) using the below code.
    <?php
                        $this->widget('ext.combobox.EJuiComboBox', array(
                        'model' => $model,
                        'attribute' => 'min',                        'data'=>array('100000.0'=>'1lakh','200000.0'=>'2lakh','300000.0'=>'3lakh','400000.0'=>'4lakh'),                              
        'assoc'=>true,                    
                        
                        'options' => array(
              'onSelect' => 'cost_change(item.value);',
                            'allowText' => false,
                        ),                  
                        'htmlOptions' => array('placeholder' => 'Min Cost', 'style'=>'width:30px'),
                    ));                
                    ?>


   

    <?php
                $this->widget('ext.combobox.EJuiComboBox', array(
                    'model' => $model,
                    'attribute' => 'max',
    'data' => array('300000.0'=>'3lakh','400000.0'=>'4lakh','500000.0'=>'5lakh','600000.0'=>'6lakh'),   
                    'options' => array(                       
                        'allowText' => false,                       
                    ),                   
                    'htmlOptions' => array('placeholder' => 'Max Cost', 'style'=>'width:30px'),
                ));               
                
                ?>  

I'm calling a script on selecting the min value which in turn calls the script

 

     <script>
            
            function cost_change(price) {
                var value = price;
                console.log("value",value);     
                  jQuery('#max').html( jQuery('#SearchForm_min_cost_select').html())
                var toKeep = jQuery('#max').filter( function( ) {
                    return parseInt(this.value) > parseInt( value);       
             } );        
               console.log("to keep",toKeep);
               jQuery('#max').html(toKeep);
            }
            </script>  

Now my problem is when I select 1lakh as min value in dropdown, 1lakh is passed to script instead of 100000.0. What should I pass to the function cost_change to pass 100000.0 instead of 1lakh.
0

#2 User is offline   Rudra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 118
  • Joined: 12-July 13

Posted 16 November 2013 - 01:17 AM

The above code works fine with array, but when it comes to key => value pairs, it fails. Please tell me how to pass the value of selected item. I tried item.value and it isn't working
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