linked field in virtual table. What am I doing wrong?

27 views
Skip to first unread message

Marco Zirino

unread,
May 16, 2025, 4:19:09 PM5/16/25
to Jam.py Users Mailing List
Hi.  I have a virtual table with linked field (category):
Screenshot 2025-05-16 at 1.00.41 PM.png
This is how I populate the table:
function  plant_next(item) {
    var selected = task.categories.selections;
    if (!selected.length) {
        selected.add(task.categories.id.value);
    }
   
   
    item.server('plant_suggestions',[selected],  function(result, err) {
            if (err) {
                item.alert('Failed to send the mail: ' + err);
            }
            else {
  // Load suggestions into a temporary dataset for the modal
            var modal = task.newplanting;
            modal.open({ open_empty: true }, function() {
                modal.disable_controls(); // avoid event firing during fill

                for (var i = 0; i < result.length; i++) {
                    modal.append();
                    modal.id.value = i;
                    modal.category.value = result[i].plant;
                    modal.plant.value = result[i].plant;
                    modal.name.value = result[i].name;
                    modal.rank.value = result[i].rank;
                    modal.post();
                }

                modal.enable_controls();
                modal.edit_options.multiselect = true; // allow selecting multiple plants
   
 
            });
            modal.view();
            }
       
        });
}
For some reason, the Category field does not display the category name.  However, when I edit the category field, it does display.  What am I doing wrong?

Screenshot 2025-05-16 at 1.18.16 PM.png


Dean D. Babic

unread,
May 16, 2025, 10:21:29 PM5/16/25
to Jam.py Users Mailing List
I'm guessing a modal.category.lookup_value?

https://northwind2.pythonanywhere.com/ has RFM Virtual table...

Fabio Lenzarini

unread,
May 19, 2025, 9:34:59 AM5/19/25
to Dean D. Babic, Jam.py Users Mailing List
Hi Marco, if you need to open immediatly the form with the new record, on the init of "modal" fields, you need to wryte also the "modal.category.lookup_value".

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/3074a19e-8e06-42fb-8bd7-a14367a98c5dn%40googlegroups.com.

Marco Zirino

unread,
May 26, 2025, 7:13:52 PM5/26/25
to Jam.py Users Mailing List
I was able to get this working by setting both properties:
item.lookup_field.value
item.lookup_field.lookup_value
Reply all
Reply to author
Forward
0 new messages