Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error with p:selectOneMenu in Primefaces 3.4.2

I recently updated Primefaces from 3.4 to 3.4.2 and now I have problems on some pages where there is p:selectOneMenu component. I see error in JavaScript console which says: TypeError: e.offset(...) is undefined. This error is logged immediately on page loading.

Does anyone know what is a problem?

like image 544
partlov Avatar asked Oct 21 '22 20:10

partlov


1 Answers

OK, after a lot of time a finally figure out what's happening. In Primefaces 3.4.2 behavior of p:selectOneMenu is changed little bit, in that way that change event is fired immediately after page is loaded. This problem is manifesting when we have completely empty p:selectOneMenu, which means value of f:selectItems is null, and there is no f:selectItem for empty option. In that case we can see error TypeError: e.offset(...) is undefined in console and javascript is from that point useless, and nothing works any more. For now it has to be empty f:selectItem, or at least one element in f:selectItems.

like image 163
partlov Avatar answered Oct 30 '22 22:10

partlov