Jump to content


setRelation Dropdown option with attribute

grocerycrud setRelation dropdown

  • Please log in to reply
No replies to this topic

#1 farazu101

farazu101

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 22 March 2018 - 03:24 AM

$crud->set_table('m_values');
$crud->columns('attribute', 'value', 'position');
$crud->set_relation('attribute', 'm_attributes', 'name', array('status' => 'Active'), 'name asc');
 

 

<select id='field-attribute' name='attribute' class='chosen-select' data-placeholder='Select Attributes' style='width:300px'>

<option value=''></option>

<option value='1' >Red</option>

<option value='2' >Yellow</option>

<option value='3' >10 Units</option>

<option value='4' >20 Units</option>

</select>

 

I am getting an output as listed above. as Expected

 

Question

 

m_attributes table contains a column named 'type'

I wanted the data in column type during option is populated as class='type'

 

<select id='field-attribute' name='attribute' class='chosen-select' data-placeholder='Select Attributes' style='width:300px'>

<option value=''></option>

<option class='Color' value='1' >Red</option>

<option class='Color' value='2' >Yellow</option>

<option class='Dropdown' value='3' >10 Units</option>

<option class='Dropdown' value='4' >20 Units</option>

</select>

 

 

So based on the selected option class attribute, I need to hide 2 textbox below in the page







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users