Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import or require. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <template>
  <q-page padding>
    <q-card flat class="bg-accent">
      <q-card-section class="q-pa-xs">
        <q-toolbar>
          <q-toolbar-title class="title">Lists</q-toolbar-title>
        </q-toolbar>
      </q-card-section>
      <q-card-section class="box bg-white q-ma-sm">
        <q-table
          gridX
          :data="lists.data"
          :columns="columns"
          row-key="id"
          selection="none"
          :loading="tblLoading"
          loading-label="Loading lists"
          :pagination.sync="pagination"
          :rows-per-page-options="rowsPerPageOptions"
          @request="onRequest"
          binary-state-sort
          :selected.sync="selected"
          flat
          separator="none"
          rows-per-page-label="Show"
          hide-headerX
          color="primary"
          table-class="tblData"
          card-class="bg-white text-brand"
        >
        </q-table>
      </q-card-section>
    </q-card>
  </q-page>
</template>
            
          
!
            
              import { debug as log } from "src/logger";

const debug = log("List");

export default {
  data() {
    return {
      leftDrawerOpen: true,
      rightDrawerOpen: false,
      tblLoading: false,
      filter: "",
      selected: [],
      columns: [
        {
          name: "status",
          label: "Status",
          field: "status",
          sortable: false,
          align: "left"
        },
        {
          name: "id",
          required: true,
          label: "List",
          align: "left",
          field: row => `[${row.id}] ${row.FileName}`,
          format: val => `${val}`,
          sortable: true
        },
        {
          name: "CreatedAt",
          label: "Uploaded",
          field: "CreatedAt",
          format: val => {
            // const createdAt = new Date(val);
            return this.$moment(val).format("MMM Do YYYY, h:mm:ss a");
          },
          sortable: true,
          align: "left"
        },
      ],
      pagination: {
        sortBy: "id",
        descending: true,
        page: 1,
        rowsPerPage: 7,
        rowsNumber: 7,
        skip: 0
      },
      rowsPerPageOptions: [7, 10, 25, 50, 100],
    };
  },
  computed: {
    ...mapGetters("lists", {
      findListInStore: "find"
    }),
    lists() {
      const query = this.listQuery();
      // Get lists from the Vuex store, which are updated reactively in real-time
      return this.findListInStore(this.listQuery());
    },
  },
  methods: {
    ...mapActions("lists", {
      findLists: "find"
    }),
    onRequest(requestProp) {
      //   debug("requestProp", requestProp);
      //   this.$q.loadingBar.start();
      this.tblLoading = true;
      let {
        page,
        rowsPerPage,
        rowsNumber,
        sortBy,
        descending
      } = requestProp.pagination;
      this.pagination = requestProp.pagination;
      const skip = (page - 1) * rowsPerPage;
      // ? IMP to set pagination here
      this.pagination.skip = skip;
      this.pagination.rowsPerPage = rowsPerPage;
      return this.findLists(this.listQuery())
        .then(response => {
          this.tblLoading = false;
          // set pagination
          this.pagination.rowsNumber = response.total;
          this.pagination.page = page;
          this.pagination.rowsPerPage = rowsPerPage;
          this.pagination.sortBy = sortBy;
          this.pagination.descending = descending;
          this.pagination.skip = skip;
        })
        .catch(e => {
          this.tblLoading = false;
          this.$q.notify({
            color: "negative",
            message: `Error ${e}`
          });
        });
    },
    listQuery() {
      const sortOrder = this.pagination.descending ? -1 : 1;
      const query = {
        $skip: this.pagination.skip,
        $limit: this.pagination.rowsPerPage,
        $sort: { [this.pagination.sortBy]: sortOrder }
      return { query };
    },
    loadListsData() {
      return  this.findLists(this.listQuery())
        .then(response => {
          this.tblLoading = false;
          this.pagination.rowsNumber = response.total;
          return response;
        })
        .catch(e => {
          this.tblLoading = false;
        });
    },
    showError(err) {
      this.$q.notify({
        color: "negative",
        message: err.message,
        icon: "report_problem"
      });
    }
  },
  mounted() {},
  created() {
    this.loadListsData();
  },
  beforeDestroy() {}
};
            
          
!
999px

Console