How to achieve it thru editable datagrid without html?
<optgroup label="Swedish Cars">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
</optgroup>
<optgroup label="German Cars">
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
I have tried below:
<table id="bulkchannel_edit" title='Editable DataGrid' singleSelect="true" style="width:100%; height:500px;">
<thead>
<tr>
<th field="channel_name" width="100" editor="{type:'textbox'}">Channel Name</th>
<th field="category_name" width="100" editor="{type:'combobox',
options:{
valueField:'channel_category_id',
textField:'category_name',
data:childCategories,
groupField:parentCategories,
required:true
}
}" formatter="getSelectedCategory">Category</th>
</tr>
</thead>
</table>
data for both group optgroup coming from ajax request below:
var parentCategories = {};
var childCategories = {};
$(document).ready(function(){
$.ajax({
url: "<?php echo base_url() ?>index.php/Channels/getParentChildChannelCategories",
dataType: 'json',
async : false,
success: function(response){
console.log('response',response);
console.log('parent_categories',response.parent_categories);
parentCategories = response.parent_categories;
childCategories = response.child_categories;
}
});
});
I have to load parentcategories in parent group and all childcategories in optgroup html
Thanks.
I got solution from jeasyui forum from here