0

When trying to edit the cell, method not found exception is thrown. I tried using an ajaxBehaviourEvent, but it is throwing ClassCastException: Sheet can not be cast to Sheet

//view     
<p:ajax  listener="#{dataListView.cellEditEvent}"  process=":form:sheet" update=":form:sheet" >
</p:ajax>

// method 
public void cellEditEvent(SheetEvent event) {

    org.primefaces.extensions.component.sheet.Sheet sheet =  event.getSheet();
    List<SheetUpdate> updates = sheet.getUpdates();
    HashSet<Sample> processed = new HashSet<Sample>();
    int rowUpdates = 0;
    for (SheetUpdate update : updates) {
        Sample asset = (Sample) update.getRowData();
        if (processed.contains(asset))
            continue;
        entityManager.merge(asset);
        System.out.println("Asset " + asset.getEmail() + " updated.");
        rowUpdates++;
        showSampleData();
    }
    sheet.commitUpdates();
}

Using PrimeFaces 6.2 and PrimeFacesExtension 6.2.3 and Seam 2.3

Ashish Mathew
  • 783
  • 5
  • 20
  • and if i use AjaxBehaviourEvent :Caused by: java.lang.ClassCastException: org.primefaces.extensions.component.sheet.Sheet cannot be cast to org.primefaces.extensions.component.sheet.Sheet public void cellEditEvent(AjaxBehaviorEvent event) { org.primefaces.extensions.component.sheet.Sheet sheet = (Sheet) event.getComponent(); List updates = sheet.getUpdates(); – Bhanu Prakash May 16 '18 at 05:50
  • Which event is the ajax listener listening to? Add `event="change"` to your `p:ajax`. – Ashish Mathew May 16 '18 at 07:51
  • Added event="change" and changed cellEditEvent(AjaxBehaviorEvent event) then error is >>> org.primefaces.extensions.component.sheet.Sheet cannot be cast to org.primefaces.extensions.component.sheet.Sheet – Bhanu Prakash May 16 '18 at 08:20
  • That seems to be a classloader issue. – Ashish Mathew May 16 '18 at 08:59
  • Any work around for this @AshishMathew , why means required jar files has been placed correctly and no dependency issue . iam using primefaces 6.2 and primefaces extension 6.2.3.jar – Bhanu Prakash May 16 '18 at 09:02
  • You can refer to this SO post https://stackoverflow.com/questions/826319/classcastexception-when-casting-to-the-same-class. – Ashish Mathew May 16 '18 at 09:11
  • Rechecked the lib files , as per the primefaces documentation primefaces 6.2 has been added to make pm-extension 6.2.3 to work !! jars are updating in lib as well as war/lib too through build.xml And for AjaxBehaviorEvent event is called correctly but the issue is with Sheet casting . – Bhanu Prakash May 16 '18 at 10:12
  • sorry for late reply . thanks @AshishMathew . there where two PF jars which were adding in to the project – Bhanu Prakash May 25 '18 at 11:26

0 Answers0