I'm trying to upgrade from Plone 5.2 to 6 and collective.z3cform.datagridfield 1.5.3 to 3.0.0. I have some code that allows a user to paste text into a single textarea that is parsed and inserted into the grid. The parsing is outside of scope here, I'm just trying to work with DGF functionality. Given a "name" object a jQuery selector "el" I can put its components into separate grid inputs like this in 1.5.3
el.find('.auto-append [id$="iname"]').val(name.initials); el.find('.auto-append [id$="lname"]').val(name.last_name); el.find('.auto-append [id$="fname"]').val(name.first_name); el.find('tr.auto-append td').trigger('change'); // make new row
In 3.0.0 I can insert into a row the same way, but the trigger to create a new row seems to have changed. Based on collective.z3cform.datagridfield/datagridfield.pattern.js at 3bc8f6bbf5fd9a442e13406f597edab37fa6d978 · collective/collective.z3cform.datagridfield · GitHub I would have thought I could do
el.find('.auto-append').trigger('focusout') but this does not do anything and I'm not sure what I need to do to generate the next line?