ServerTableComponent

This component allows you to create a custome server table. With server means it connects to a server API end-point. It depends on ValidationObserver from Vee Validate and it can receive any type of column-component created in the definition binded.

Example

ServerTableComponent

<template>
  <div>
    <section>
      <server-table-component
        data-url="/services"
        v-bind="servicesDefinition"
      />
    </section>
  </div>
</template>;

export default {
  name: "App",
  data() {
    return {
      servicesDefinition: {
        vtable: {
          headers: [
            {
              text: "Service Id",
              value: "service_Id",
              align: "left",
              render: {
                type: NumberFormatColumnComponent,
              },
              sortable: true,
              class: "white-space-nowrap",
            },
            {
              text: "Service Name",
              value: "service_Name",
              align: "left",
              sortable: true,
              custom: true,
              render: {
                type: ContentButtonColumnComponent,
                props: {
                  content: "service_Name",
                  button: {
                    isRounded: true,
                    type: "",
                    icon: "monitor",
                    size: "is-small",
                    tooltip: {
                      label: "Visualize original values",
                      position: "is-top",
                      type: "is-white",
                    },
                  },
                },
                events: {
                  "button-clicked": this.showOriginalValues,
                },
              },
            },
            {
              text: "Service Provider",
              value: "service_Provider_Name",
              align: "left",
              sortable: true,
              custom: true,
              render: {
                type: ContentButtonColumnComponent,
                props: {
                  content: "service_Provider_Name",
                  button: {
                    isRounded: true,
                    type: "",
                    icon: "monitor",
                    size: "is-small",
                    tooltip: {
                      label: "Visualize original values",
                      position: "is-top",
                      type: "is-white",
                    },
                  },
                },
                events: {
                  "button-clicked": this.showOriginalValuesProvider,
                },
              },
            },
            {
              text: "Service Type",
              value: "service_Type_Name",
              align: "left",
              sortable: true,
              rendervalue: (v) => this.$snakeToTitle(v),
            },
            {
              text: "Event Actions",
              value: "",
              align: "left",
              render: {
                type: MultipleButtonsColumnComponent,
                props: {
                  buttons: [
                    {
                      icon: "monitor",
                      type: "is-primary",
                      tooltip: {
                        label: "Visualize events",
                        type: "is-primary",
                        position: "is-top",
                      },
                    },
                  ],
                },
                events: {
                  button0Clicked: this.visualizeServiceEvents,
                },
              },
              sortable: false,
            },
          ],
        },
        vbtn: {
          create: {
            show: false,
          },
        },
        title: "Services",
        sortTypeField: "sortType",
        findSearchField: "searchText",
        sortWithSign: true,
        sortFieldName: "sorts",
        paginationLengthField: "pageSize",
        headerIcon: "animation",
      },
    };
  },
};

Is mandatory that each column's header has it correspond value property. Is important to note that the value property is necesary not only to display a column text value, also it's received as a parameter on table sort event. If the value is not defined the sort method is not applied correctly.

The column's components available

Props

NameDescriptionTypeRequiredDefault
title-Stringfalse"Table Component"
subtitle-Stringfalseundefined
dataUrlThe URL to conect to the API end-pointStringfalsenull
modalWidthThe modal widthNumberfalse400
stickyHeadersShow a sticky table headerBooleanfalsetrue
rowClass-Functionfalseundefined
isRowChekable-Functionfalse() => true
selectedSyncActive-Booleanfalsefalse
notify-Booleanfalsetrue
selected-Objectfalsenull
selectable-Booleanfalsefalse
customHeaders-Booleanfalsefalse
isDetailed-Booleanfalsefalse
showDetailIcon-Booleanfalsetrue
eventConstantsTo check events errors with eventsErrorCheckMixinObjectfalse[object Object]
checkedRowsIdsList of external Ids of checked rows to checkArrayfalse
getCheckedRowsReturn [] of row objects that fit a criteria to sync to internal checked rows. Recives (ids, records)Functionfalseundefined
localeLocale string {en, es ...} for display language on componentStringfalse"es"
nameName of the component that uses itStringfalse""
dbclick-Booleanfalsefalse

Events

Event NameDescriptionParameters
checkedRows--
selectedRow--
update:selected--
clearSearch--
dbclick:selected--
columnDragStart--
columndrop--
available-records--
form-closeFire an event to the parent when the form is closed-
before-form-openFire an event to the parent before the form will open. Retrieves form and id if editing-
form-openFire an event to the parent before when the form is open-
dragStart--
onDrop--
contextmenu--
open-column-filter--
cleanFilters--

Slots

NameDescriptionDefault Slot Content
header-extra-contentHeader extra content-
extra-header-buttonsHeader extra buttons-
right-extra-header-contentHeader extra buttons-
extra-contentExtra content-