Giter Site home page Giter Site logo

Comments (9)

rjaros avatar rjaros commented on September 2, 2024 2

I'v got a Tabulator module on my (long) TODO list ;-)

I'm also aware of some performance problems with both data container and redux module, which both work with the same pattern - by removing and recreating components inside a container. I'm trying to apply some optimizations. Maybe you could share a sample project in which you encounter these problems.

from kvision.

rjaros avatar rjaros commented on September 2, 2024 1

You can't use standard FormPanel this way, because it always renders as a "form" with "div"s for its items. But it's fairly easy to create new FormPanel, which will render as a "tr" with "td"s. Just inherit and override two methods:

class RowFormPanel : FormPanel<SomeClass>(serializer = SomeClass.serializer()) {
    override fun render(): VNode {
        return render("tr", childrenVNodes())
    }
    override fun childrenVNodes(): Array<VNode> {
        return super.childrenVNodes().map {
            h("td", arrayOf(it))
        }.toTypedArray()
    }
}

I have tested this RowFormPanel class with this code:

            val tableTemplate = Table(
                listOf("Column 1", "Column 2"),
                responsive = true
            )
            dataContainer(rowList, { element, idx, list ->
                val internalFormPanel = RowFormPanel()
                val text = Text()
                text.setEventListener<Text> {
                    change = {
                        list[idx] = internalFormPanel.getData()
                    }
                }
                internalFormPanel.add(
                    SomeClass::one,
                    text
                )
                val text2 = Text()
                text2.setEventListener<Text> {
                    change = {
                        list[idx] = internalFormPanel.getData()
                    }
                }
                internalFormPanel.add(
                    SomeClass::two,
                    text2
                )
                internalFormPanel.add(Button("Delete").onClick {
                    list.removeAt(idx)
                })
                internalFormPanel.setData(element)
                internalFormPanel
            }, tableTemplate)
            button("Add row").onClick {
                rowList.add(SomeClass())
            }
            button("Print data").onClick {
                println(rowList.toList())
            }

It's rather ugly (definitely needs some styling) but fully working :-)

from kvision.

rjaros avatar rjaros commented on September 2, 2024 1

kvision-tabulator module is almost ready. It will be available in the next realese.

from kvision.

robert-cronin avatar robert-cronin commented on September 2, 2024

Great thank you!

from kvision.

robert-cronin avatar robert-cronin commented on September 2, 2024

I am just getting around to testing this fully and have realized it becomes a little slow when you try to try to load any more than 20 entries at once, is it possible to request an integration with kotlin-react-dom or some kind of reactive editable table for next release?

from kvision.

robert-cronin avatar robert-cronin commented on September 2, 2024

tabulator looks awesome, that would solve all my problems!
Great I'll see what I can do about the sample project

from kvision.

robert-cronin avatar robert-cronin commented on September 2, 2024

Thats great news, things really move quickly around here 👍

from kvision.

rjaros avatar rjaros commented on September 2, 2024

I've updated the guide with some information and sample code on tabulator module usage. There is also rewritten addressbook-tabulator example and small sample in the showcase app.

from kvision.

robert-cronin avatar robert-cronin commented on September 2, 2024

Thank you Robert

from kvision.

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.