jcchavezs / cmb2-conditionals

Plugin to relate fields in a CMB2 metabox

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditionals not working when group elements are reordered.

jrfnl opened this issue · comments

From @siamzam in #2:

Thanks for the solution to the issue 2 "Fields conditional on other fields within groups". It works great.
However, there is one small problem. Whenever the group elements are sorted using the up and down buttons the conditional functionality does not work e.g. all the hidden elements are shown again.

Can you plz have a look at that?

I added this custom javascript code to cmb2-conditionals.js on line 38 and fixed it;

changeContext.on( 'click', 'a.cmb-shift-rows', function() { $.each( $('#dynamic_boxes_repeat_group_repeat .cmb-repeatable-grouping'), function( key, value ) { $(value).find("select").trigger("change"); }); });