Add a button to each row in a view form

25 views
Skip to first unread message

Moh. Sarip Hidayat

unread,
Apr 16, 2025, 5:23:21 PMApr 16
to Jam.py Users Mailing List

Hey there,

I'm trying to add a button to each row in a view form. From what I can tell, it seems like this should be doable using the `row_callback` function.

I’ve looked around but haven’t found any examples—either here or in the docs.

Is this actually possible? Any pointers would be super helpful.

Thanks!
Moh. Sarip Hidayat

Dean D. Babic

unread,
Apr 16, 2025, 8:53:01 PMApr 16
to Jam.py Users Mailing List
Hi,
I'm afraid not.
The other option is multiselect and normal action button. 
For mobile devices, the usable area is sparse.

There might be some options with templates, but not sure:
https://groups.google.com/g/jam-py/c/5H1jVx5hl0k/m/w9tRJx6JBgAJ
This actually looks funny when scrolling.

D.

Moh. Sarip Hidayat

unread,
Apr 17, 2025, 7:14:58 AMApr 17
to Jam.py Users Mailing List
I see, that's unfortunate. Thanks for clarifying and have a nice day!

Fabio Lenzarini

unread,
7:52 AM (11 hours ago) 7:52 AM
to Moh. Sarip Hidayat, Jam.py Users Mailing List
Hello everyone,
I managed to insert a “working” button in the display grids.
For those interested, here is the code:
in the item's client code:

function on_field_get_html(field) {
    var item = field.owner;
   
    if (field.field_name === ‘documents’) {
        return ‘<button class="btn btn-primary" onclick="open_target_user_attachment(’ + item.id.value + ‘)">Click</button>’;
    }
}

function open_documents(id) {
    // alert(“You clicked on record ID: ” + id);
    var target_user_attachment = task.target_user_attachment.copy({handlers: false});
    target_user_attachment.set_where({user: id});
    target_user_attachment.open();
    target_user_attachment.view(task.forms_container); // full screen
}

in the index.html page:

        <script>
            $(document).ready(function(){
                task.load();
            });

            function open_target_user_attachment(id) {
                task.users_recipients.open_documents(id);
            }

        </script>
    </body>
</html>

enjoy
ciao
Fabio

--
You received this message because you are subscribed to the Google Groups "Jam.py Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jam-py+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/jam-py/499c6670-fc4f-411c-a9fc-ee1accbe602cn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages