Giter Club home page Giter Club logo

Comments (4)

mwchase avatar mwchase commented on May 28, 2024

After I thought about this overnight, it occurred to me that there might be a workaround. I'll see if it works later today; it might be possible to make this simply a recipe in the documentation.

from marimo.

mwchase avatar mwchase commented on May 28, 2024

I was able to hack this together by using a text field in another cell to get input to a filtering operation to preprocess the table, and then put them in a vstack. I'll try to get it looking better and do a writeup over the weekend.

from marimo.

mwchase avatar mwchase commented on May 28, 2024

Here's what I've got so far:

@app.cell
def __(mo):
    filter_text = mo.ui.text()
    return filter_text,


@app.cell
def __():
    table_entries = []  # Edit this to have something actually interesting in there.
    return table_entries,


@app.cell
def __(filter_text, table_entries, mo):
    def _filter_on_column(column, text, dicts):
        return [dct for dct in dicts if text in dct[column]]


    _stack = mo.vstack(
        (
            mo.hstack(("Filter by:", filter_text), justify="end"),
            mo.ui.table(
                _filter_on_column("Column Name", filter_text.value, table_entries)
            ),
        )
    )

    DOCUMENTATION_SECTION = f"{_stack}"
    return DOCUMENTATION_SECTION,

I'm going to say that this will hold me for now, but there are a few possible areas of improvement, some of which may interfere with each other:

  • I haven't tried to get it working with any input type besides "list of dicts"
  • It would be nice to have regex or fuzzy search
  • It would be nice if the matches were bolded or otherwise highlighted

from marimo.

mwchase avatar mwchase commented on May 28, 2024

... Of course, it also works to skip making the hstack and just use the label argument to text().

from marimo.

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.