Set column width

22 views
Skip to first unread message

Fabio Lenzarini

unread,
Apr 18, 2024, 11:48:19 AMApr 18
to Jam.py Users Mailing List
Hi all, is possible to set the column width of a column into a view?

Is a "Long text notes".

If the field is empty, ok, if I've an image inside, I get this


2024-04-18 17_46_01-Clipboard.png

thanks
Fabio

Danijel Kaurin

unread,
Apr 18, 2024, 2:30:57 PMApr 18
to Fabio Lenzarini, Jam.py Users Mailing List
Hi Fabio.

Here is docs page. Try with: item.table_options.column_width = {'track': '25%', 'album': '25%', 'artists': '10%'}

--
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 on the web visit https://groups.google.com/d/msgid/jam-py/2af5d43f-b77b-4f5f-bdfe-903dc7910090n%40googlegroups.com.

Fabio Lenzarini

unread,
Apr 19, 2024, 3:54:25 AMApr 19
to Jam.py Users Mailing List
Hi  Danijel,
for me, don't work..

function on_view_form_created(item) {
   
    item.filters.done.value = 0;

    let table_height = item.table_options.height; 
    var fields = {'id' : 'notes' : 'user'};
                                   
    var column_width = {'Notes' : '25%'};
    var options = {
                    fields: fields,
height: table_height,
word_wrap: false,
column_width: column_width
};


// item.table_options = options;
item.table_options.column_width = {'notes' : '25%', 'user' : "50%"};

}

Fabio Lenzarini

unread,
Apr 19, 2024, 7:58:07 AMApr 19
to Jam.py Users Mailing List
Found solution.
If you use a long text as a HTML editor container, remove all image before display on the view table:

function on_field_get_html(field) {
var item = field.owner;

if (field.field_name === 'notes') {
    let text = item.notes.value
   
    var content = $('<p>').html(text).find('img').remove().end().html();
   
        let element = document.createElement('div');

        element.innerHTML = content;
    return element.innerText;

}

}

Danijel Kaurin

unread,
Apr 19, 2024, 1:29:31 PMApr 19
to Fabio Lenzarini, Jam.py Users Mailing List
Hi Fabio,

I think that right way for usage of this is to add columns names and with parameters in [] as object:

var column_width = {{'Notes' : '25%'}];

Reply all
Reply to author
Forward
0 new messages