Git Product home page Git Product logo

Comments (8)

rodrigoAbril avatar rodrigoAbril commented on September 13, 2024 1

@MicroDroid I have tried, but when the tables render there are always some rows out of order.
In my case the first one will always be the row with id 57, but when i click to sort by id everyting fixes up....

I also noticed that the demo image in the documentation has the same error (first one is id 26)
687474703a2f2f692e696d6775722e636f6d2f313574417058752e706e67

from vue-materialize-datatable.

MicroDroid avatar MicroDroid commented on September 13, 2024

This should be a good place for improvement.

For now, try ordering the dataset outside the plugin on initial render

from vue-materialize-datatable.

justice47 avatar justice47 commented on September 13, 2024

@rodrigoAbril I understand that your question was asked nearly 2 years ago, but here is temporary solution:
in DataTable.vue find sortColumn data and change it to the column number you want your component to be sorted by on init.
@MicroDroid can we implement some new prop (:initSort=1/2/3/etc for example), which will change initial sorting?

from vue-materialize-datatable.

rodrigoAbril avatar rodrigoAbril commented on September 13, 2024

:) seems like a good solution

from vue-materialize-datatable.

MicroDroid avatar MicroDroid commented on September 13, 2024

@justice47 I'd rather find a better way since this is a controlled component and I'd rather not use local state with a prop like that.

from vue-materialize-datatable.

justice47 avatar justice47 commented on September 13, 2024

@MicroDroid ok, if you will find a better way just post your thoughts about it, I can try to help you with that!

from vue-materialize-datatable.

justice47 avatar justice47 commented on September 13, 2024

@MicroDroid maybe this approach will suit all needs:
Lets stay with sortColumn in data and change it only once, when component is mounted.
Example:
props

props: {
 ...,
 initSortCol: {default: 0}
}

data

data: () => ({
 ...,
 sortColumn: 0,
}

mounted hook

mounted: function() {
 ...
 this.sortColumn = this.initSortCol
}

and then in component call

<datatable
 ...
 :initSortCol="2"
>

from vue-materialize-datatable.

MicroDroid avatar MicroDroid commented on September 13, 2024

Closed in #42

from vue-materialize-datatable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.