p:collector display only one record - primefaces

I test the example of p:collector on the primefaces site but it didn't work for me,
the add button only added one record, when I add a second, the datatable display only the lastest one.
NB: I have added ajax="false" for the add button, if not, the button doesn't work.

This solved my problem, sorry for my english But I have not learned at all.
I just changed THE SCOPE OF MY BEAN it was #RequestScoped And I CHANGE IT to:
#ManagedBean
#ViewScoped
Hope this helps

The entity class has the #override methods, which were generated while creating new entity through create new entity wizard. remove all the overridden methods from the entity and save it. Thats all. Now it will work.

Related

Action script 3.0 reusable button function

I am new to AS3.0 and am trying to create a reusable button class. I am working on a quiz game where I have multiple correct and incorrect buttons and instead of copying the same code over and over again I am trying to create a simple way to reuse the code. I am unaware how to do this. I have created various generic button classes and none have worked. I believe the best way would revolve around creating a generic class with a Boolean 'correct' and each button class extends this parent class and sets the correct Boolean true or false. In the parent class there would be a function saying if correct then go to next frame, if !correct go to lose frame. I have tried this but to no avail; any help?
If that's a design question, then no, a button should not know if it's "the correct one" in a given quiz. All logic should be handled by button's parents, whatever type they are. A simple design would do like this: Create a set of buttons with texts, then you addEventListener(MouseEvent.CLICK,someFunction) to each, where someFunction is one for the correct button, and another for wrong-answer buttons.

How to add a form class as a library class in Access VBA

Most of my Form classes are not part of the library but some are. Those that are part of class library have the members that I need to use in the Form classes. How do I make it so Class is part of the Class library? Or Don't I even have to switch the form class to library class to access a Junction_ID member? or how do I even add the Junction_ID member to my form class without switching it to the library class? For example in below picture I want to use that Junction_ID as a member of Form_supfrm_CenteneTexas_Interview. I haven't ever dealt with this before so please help!
You can access each control of an opened form from anywhere in your project. [http://msdn.microsoft.com/en-us/library/office/ff195841%28v=office.15%29.aspx]

Primefaces datatable reset pagination

I am using the dataTable component with the paginator in a search utility which works great but having a problem to reset paginator page to the first page.
for example you are on page 6 of the paginator and you perform a new search, the dataTable gets reloaded with the new data but, the page number is not reset to 1 it remains on 6.
I'm using PF 3.4.2.
any idea?
Add the following javascript to the action which updates the DataTable's model:
onclick="myWidgetVar.getPaginator().setPage(0);"
Where myWidgerVar is the WidgetVar for the DataTable.
Ensure that the DataTable has a WidgetVar set. For further context, see this post by Optimus Prime.
The above causes the grid to make a call to refresh data with existing filters. If you explicitly want the grid to load new data from page one, you can reset the datatable on server side
DataTable dataTable = (DataTable) FacesContext.getCurrentInstance().getViewRoot().findComponent("dialogSelectionForm:carSelectDialogTable");
dataTable.reset();
Reference - http://forum.primefaces.org/viewtopic.php?f=3&t=5807
I solved with widgetVarDataTable.clearFilters(); in primefaces 3.5,
and PF('widgetVarDataTable').clearFilters(); in primefaces 5.0
I solved my problem using PF('dataTableWidgetVar').paginator.setPage(0); in Primefaces 6.0
I had to solve this need in the back-end. To solve the problem without executing some sort of "duplicated refresh" I did implement this:
<p:commandButton ... update="dataTable" actionListener="#{myController.bindingDataTable.setFirst(0)}" oncomplete="someClientJS();" ... />
This code assumes the dataTable in the front-end is binding to the back-end reference variable myController.bindingDataTable. The ActionListener executes before the dataTable gets refreshed, so for that moment the paging is set with '0' as value for the first row/record (hence, first page as well).

inheriting user controls

For ease of management of a UI that has many elements shown as user controls, I would like my user controls to be inherited from a class of my own. So, in my user control, where there was:
Inherits UserControl
I changed it to
Inherits MyBaseUserControl
And I added a class MyBaseUserControl, which just inherits from UserControl.
It won't run immediately because the autogenerated intermediate file (.g.i.vb) for the UserControl inherits like this:
Inherits Global.Windows.UI.Xaml.Controls.UserControl
.. but if I then edit the intermediate file to
Inherits MyBaseUserControl
it works great, I can effectively identify my own user controls and add properties and methods to them generically, which is exactly what I want to do.
But of course, if I edit the user control in the designer, the intermediate file is regenerated with
Inherits Global.Windows.UI.Xaml.Controls.UserControl
I could manually edit the intermediate file whenever is gets recreated but it seems messy / dangerous.
Is there a way to do this properly?
Thanks
You need to replace the UserControl strings in your XAML with MyBaseUserControl. E.g.
<controls:MyBaseUserControl
x:Class="Sp.MyBaseUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Sp">
...
</controls:MyBaseUserControl>
Where Sp is the namespace that MyBaseUserControl is in.

How to Control a Class Name class="fValidate['required']" in MooTools

I am using fValidator plugin for MooTools, and find necessary to control (depending on user selections) the required class it's used by the plugin.
The class uses a weird formatting which have never used before and for some reason MooTools can recognize it. It probably has something to do with escaping the square brackets and the single quotes.
I tried something like this, among other things, but no luck yet.
This is the code:
$("checkbox3").removeClass("fValidate\\[\\'required\\'\\]");
Are you looking to remove/add required elements to the validation? As it picks up all the elements at first you'd have to unregister them, remove the class and then re-register them.
Unfortunately it doesn't seem to have an unregister method by default so you'd have to monkey patch the script to add this, also as the register method doesn't parse class names you'd have to add a new method that does this. Finally you'd have to make the event that is added to the field for the blur in register a binding that you could re-use the binding to remove that event
It's quite an involved patch/rewrite of fValidator to achieve this and if possible I would look at another validation script -- such as form check which does allow you to un-register and re-register fields at run time (among a lot of other improvements).