flask-gridjs icon indicating copy to clipboard operation
flask-gridjs copied to clipboard

dropdown with gridjs possible?

Open mhanuel26 opened this issue 2 years ago • 5 comments

Hi @miguelgrinberg ,

Is there a way to have a drop down withing a gridjs table? Any example available.

Will aprpeciate your comments, Thanks,

mhanuel26 avatar Aug 06 '22 05:08 mhanuel26

I don't have any examples specific to a drop-down, but the server example in this repository shows how to add email links, which is somewhat similar in the sense that both require putting HTML in a cell.

miguelgrinberg avatar Aug 06 '22 08:08 miguelgrinberg

Hi @miguelgrinberg ,

Sorry but for some reason I cannot see the insertion of an html email link working on the server example, it looks like simple text in the table to be honest. Maybe is something you haven't push?

Thanks again,

mhanuel26 avatar Aug 07 '22 05:08 mhanuel26

@mhanuel26 This is the commit in which I've changed the emails to be links: https://github.com/miguelgrinberg/flask-gridjs/commit/0067609ce963c7c0b76d5266c60ab92115e7b3b5. The change was made a while ago, so you probably have an outdated repository.

miguelgrinberg avatar Aug 07 '22 11:08 miguelgrinberg

Hi @miguelgrinberg,

Thanks for that, one more question, I noticed that when loading the html this way, the code that does the return is executed 3 times per row on the table, for example after placing a console log before the return like this

          { id: 'email', name: 'Email', formatter: (cell, row) => {
            console.log("email");
            return gridjs.html('<a href="mailto:' + cell + '">' + cell + '</a>');
          }},

I got

flask-gridjs-1

Is this expected? I was introducing some javascript code to help in the dropdown thing and noticed this.

Will appreciate your comments, Thanks again,

mhanuel26 avatar Aug 09 '22 11:08 mhanuel26

@mhanuel26 This i something that you need to ask in the gridjs project, I'm not really familiar with its internals. Sorry.

miguelgrinberg avatar Aug 09 '22 11:08 miguelgrinberg