Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <dx-select-box ref="obat" v-model="testSearch" />
- </template>
- <script>
- import CustomStore from 'devextreme/data/custom_store'
- import axiosIns from '@libs/axios'
- export default {
- computed: {
- obatSelectBox() {
- return this.$refs['obat'] && this.$refs['obat'].instance
- },
- obatSelectBoxDataSource() {
- return new CustomStore({
- key: 'id',
- loadMode: 'processed',
- byKey: (key) => {
- },
- load: (loadOptions) => {
- console.log('loadOptions', loadOptions);
- return axiosIns.get('/v1/farmasi/service_reference/pharmacy_items?patient_checkin_id=1&type=big&search='+loadOptions.searchValue).then(response => {
- if (response.status !== 200) {
- throw Error(response.statusText);
- }
- return response.data.data;
- }).catch(() => {
- throw 'Network error'
- });
- }
- });
- }
- },
- mounted() {
- this.initComponent()
- },
- data() {
- return {
- };
- },
- methods: {
- initComponent() {
- const vm = this
- vm.obatSelectBox.option({
- hoverStateEnabled: false,
- elementAttr: { class: 'w-full' },
- dataSource: vm.obatSelectBoxDataSource,
- valueExpr: "id",
- displayExpr: "name",
- searchEnabled: true,
- showClearButton: false,
- showDropDownButton: true,
- showDataBeforeSearch: false,
- onValueChanged: function(e) {
- console.log('onValueChanged', e);
- },
- })
- },
- }
- };
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement