Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

b:datatable sending null for onselect ajax call - Internet Explorer 11 #878

Closed
kvj2020 opened this issue Oct 4, 2017 · 10 comments · Fixed by #1121
Closed

b:datatable sending null for onselect ajax call - Internet Explorer 11 #878

kvj2020 opened this issue Oct 4, 2017 · 10 comments · Fixed by #1121
Assignees
Labels
dataTable Issues with the main Topic dataTable Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation.
Milestone

Comments

@kvj2020
Copy link

kvj2020 commented Oct 4, 2017

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

<b:dataTable id="bpDataTable" value="#{myBean.list}"
	  select="true" ajax="true"  paginated ="false" searching="false"
	  var="myVal" onselect="ajax:myBean.doSelect(myVal)">
@sometowngeek
Copy link

sometowngeek commented Nov 15, 2018

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.

@sometowngeek
Copy link

@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).


Versions:

  • BootsFaces: 1.3.0
  • Java: 1.8.0
  • JSF: 2.0
  • Browser: Internet Explorer 11.2x

MCVE of thisThing.xhtml:

<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>

MCVE of fooBean.java:

@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)"

Snapshot:

Fired function with null parameter

How do I pass foo.id or even foo to the function?

@geopossachs geopossachs added the dataTable Issues with the main Topic dataTable label Nov 24, 2019
@kd-apzumi
Copy link

Any updates to this issue? I am experiencing similar problem on IE 11

@geopossachs
Copy link
Collaborator

geopossachs commented Jan 20, 2020

grafik

Post in chrome

@geopossachs
Copy link
Collaborator

grafik

Post im IE

@geopossachs
Copy link
Collaborator

only paramter indexes is divergent
IE [5]
Chrome 5

geopossachs added a commit to geopossachs/BootsFaces-OSP that referenced this issue Jan 20, 2020
@geopossachs
Copy link
Collaborator

#1121

@geopossachs geopossachs added this to the v1.5.0 milestone Jan 20, 2020
@geopossachs geopossachs added this to To Do in BootsFaces 1.5.0 via automation Jan 20, 2020
@geopossachs geopossachs self-assigned this Jan 20, 2020
@geopossachs
Copy link
Collaborator

@kd-apzumi can you check if my fix is also working in your application?

@kd-apzumi
Copy link

@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.

@geopossachs
Copy link
Collaborator

@kd-apzumi I have a new idea, I use a regex to split the different entries and only use the first index

@geopossachs geopossachs linked a pull request May 1, 2020 that will close this issue
@geopossachs geopossachs added the Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation. label May 1, 2020
BootsFaces 1.5.0 automation moved this from To Do to DONE May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dataTable Issues with the main Topic dataTable Solved This ticket has been solved. If it's still open, we're waiting for the user's confirmation.
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

4 participants