Advertisement
Guest User

Untitled

a guest
May 22nd, 2023
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <template>
  2. <dx-select-box ref="obat" v-model="testSearch" />
  3. </template>
  4.  
  5. <script>
  6. import CustomStore from 'devextreme/data/custom_store'
  7. import axiosIns from '@libs/axios'
  8.  
  9. export default {
  10. computed: {
  11. obatSelectBox() {
  12. return this.$refs['obat'] && this.$refs['obat'].instance
  13. },
  14. obatSelectBoxDataSource() {
  15. return new CustomStore({
  16. key: 'id',
  17. loadMode: 'processed',
  18. byKey: (key) => {
  19.  
  20. },
  21. load: (loadOptions) => {
  22. console.log('loadOptions', loadOptions);
  23.  
  24. return axiosIns.get('/v1/farmasi/service_reference/pharmacy_items?patient_checkin_id=1&type=big&search='+loadOptions.searchValue).then(response => {
  25. if (response.status !== 200) {
  26. throw Error(response.statusText);
  27. }
  28.  
  29. return response.data.data;
  30. }).catch(() => {
  31. throw 'Network error'
  32. });
  33. }
  34. });
  35. }
  36. },
  37. mounted() {
  38. this.initComponent()
  39. },
  40. data() {
  41. return {
  42.  
  43. };
  44. },
  45. methods: {
  46. initComponent() {
  47. const vm = this
  48.  
  49. vm.obatSelectBox.option({
  50. hoverStateEnabled: false,
  51. elementAttr: { class: 'w-full' },
  52. dataSource: vm.obatSelectBoxDataSource,
  53. valueExpr: "id",
  54. displayExpr: "name",
  55. searchEnabled: true,
  56. showClearButton: false,
  57. showDropDownButton: true,
  58. showDataBeforeSearch: false,
  59. onValueChanged: function(e) {
  60. console.log('onValueChanged', e);
  61. },
  62. })
  63. },
  64. }
  65. };
  66. </script>
  67.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement