Closed malohtie closed 4 years ago
Hi malohtie,
I guess the most straight forward way is to get the number of rows by getRowCount first and then get the select DOM element by getCellCtrl and change the selectedIndex
of it. For example,
// Initilize the grid
var myAppendGrid = new AppendGrid({
columns:[
{
name: 'dropdown',
type: 'select'
}
]
});
// When your button clicked
$('#button').on('click', function(){
var total = myAppendGrid.getRowCount();
for (var z = 0; z < total; z++) {
// Get the select element
var select = myAppendGrid.getCellCtrl('dropdown', z);
// Change the selected index
select.selectedIndex = 0;
// Optional: Trigger change event if required
$(select).trigger('change');
}
});
let say i have a button outside the grid and want to select the first option in all select available in appendGrid, cant find an option in the api is this possible ? thanks