Closed kvj2020 closed 4 years ago
I have the same issue.
This has been open for a little over a year and I don't see any updates.
Is anyone looking into this?
@stephanrauh I noticed you are active in the issues tab and I thought maybe this is something worth looking into.
@stephanrauh requested I open an issue, but since this issue already exists, I figured I should post it as a comment in here instead of opening another issue ticket for the same thing.
This is posted on StackOverflow - Getting a null value passed to a Java function via BootsFaces datatable.
I am trying to create a modal to send user-selected requests to an email address; however, I am having trouble getting the user-selected requests. I keep getting the null value passed through fooBean.setSelected(id)
.
<b:dataTable value="#{fooBean.newRequests}"
var="foo"
onselect="ajax:fooBean.setSelected(id)"
ondeselect="ajax:fooBean.setSelected(id)"
selectedItems="row"
selection-mode="multiple"
selectedRows="#{foo.selected}"
saveState="false">
<b:dataTableColumn label="Select">
<b:selectBooleanCheckbox value="#{foo.selected}" />
</b:dataTableColumn>
<b:dataTableColumn label="Status" value="#{foo.status}" />
<b:dataTableColumn label="Request Number"
value="#{foo.requestNumber}"
data-type="string" />
<b:dataTableColumn label="ID" value="#{foo.id}" />
<b:dataTableColumn value="#{foo.storeName}"
label="Store Name" />
</b:dataTable>
@ManagedBean(name="fooBean")
@ViewScoped
public class fooBean extends BeanBase implements Serializable {
private List<FooRecord> fooRecords = new ArrayList<FooRecord>();
private List<FooRecord> selectedFooRecords = new ArrayList<FooRecord>();
// ...
public void setSelected(String requestId) {
// This is not how I really do it, but it gives an idea
// with what I intend to do.
this.fooRecords.stream().filter(...).toggleSelection();
this.selectedFooRecords.stream().filter(...).toggleSelection();
}
}
I found when I debug through the fooBean.getSelected(String requestId)
, it shows null
being passed through as parameter. I have even tried:
<!-- Using varName.property -->
onselect="ajax:fooBean.setSelected(foo.id)"
<!-- Using just the property name -->
onselect="ajax:fooBean.setSelected(id)"
<!-- Using the loop variable -->
onselect="ajax:fooBean.setSelected(foo)"
How do I pass foo.id
or even foo
to the function?
Any updates to this issue? I am experiencing similar problem on IE 11
Post in chrome
Post im IE
only paramter indexes is divergent IE [5] Chrome 5
@kd-apzumi can you check if my fix is also working in your application?
@geopossachs I have used a similar approach you have posted. Indexes are passed correctly from the client side. I removed square brackets and then basing on given indexes I were able to properly set selected item/items. But this approach is rather hacky. I am curious why only on IE the object is not passed, but is null. When I debugged it looks like data attribute in event is null.
@kd-apzumi I have a new idea, I use a regex to split the different entries and only use the first index
I have a datatable that sends null to the MyBean.doSelect(MyObj obj) when I use Internet Explorer 11. It works fine for Chrome and Firefox. I am using BootsFaces 1.2.0 latest snapshot