<fine-grid id='myGrid1'>
</fine-grid>
<select class="form-control" onchange="changeTheme(this);">
<option>default</option>
<option>flat</option>
<option>dark</option>
</select>
<script type="text/javascript">
function changeTheme(select) {
var el = document.getElementById('myGrid1');
var theme = select.selectedOptions[0].textContent;
el.set('theme', theme);
}
fine.ready(function(e) {
var el = document.getElementById('myGrid1');
el.setConfig({
height: '400px',
showToolbar: true,
columns: [{
field: "customerNumber",
title: "ID",
width: '70px',
filtering: false,
editable: false,
}, {
field: "customerName",
title: "Customer Name",
width: '35%',
}, {
field: "phone",
title: "Phone",
width: '100px',
filtering: false,
}, {
field: "city",
title: "City",
}, {
field: "country",
title: "Country",
}, {
commands: ["Edit", "Delete"],
editingCommands: ["Save", "Cancel"],
width: '120px',
filtering: false,
title: "",
}],
dataSource: {
schema: {
model: {
idField: 'customerNumber',
fields: {
customerNumber: {
type: 'string'
},
customerName: {
type: 'string'
},
phone: {
type: 'number'
},
city: {
type: 'string'
},
country: {
type: 'string'
}
}
}
},
transport: {
read: {
// url: "../../includes/getTable.php",
url: "../php/example.php",
dataType: "text"
},
update: {
// url: "../../includes/updateTable.php",
url: "../php/example.php",
dataType: "text"
},
create: {
url: "../php/example.php",
dataType: "text"
},
destroy: {
url: "../php/example.php",
dataType: "text"
}
},
serverPaging: false,
serverFiltering: false,
serverSorting: false,
},
paging: {
pageSize: 10
},
sorting: {
type: 'multiple',
},
filtering: true,
editing: 'batch'
});
});
</script>