Custom Backend Service
Intro
Instructions
<script setup lang="ts">
import { type Column, Filters, Formatters, OperatorType, SlickgridVue, SortDirection } from 'slickgrid-vue';
import { onBeforeMount, onMounted, onUnmounted, ref, type Ref } from 'vue';
const gridOptions = ref<GridOption>();
const columnDefinitions: Ref<Column[]> = ref([]);
const dataset = ref<any[]>([]);
const isDataLoaded = ref(false);
onBeforeMount(() => {
defineGrid();
});
function defineGrid() {
columnDefinitions.value = [/* ... */];
gridOptions.value = {
backendServiceApi: {
service: new YourCustomBackendService(),
options: {
// custom service options that extends "backendServiceOption" interface
},
preProcess: () => !isDataLoaded.value ? displaySpinner(true) : '',
process: (query) => getCountries(query),
postProcess: (result) => {
displaySpinner(false);
isDataLoaded.value = true;
}
} as YourCustomBackendServiceApi
};
}
</script>Last updated