Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
644
ClassCastException for Grid
posted

Hi all, I am getting bellow error while running my xhtml page.

java.lang.ClassCastException: com.infragistics.faces.grid.component.GridView cannot be cast to com.infragistics.faces.grid.component.html.HtmlGridView

 

My grid code is as below which is included in a xhtml page.

 <fieldset xmlns:f="http://java.sun.com/jsf/core"
 xmlns:c="http://java.sun.com/jstl/core"
 xmlns:h="http://java.sun.com/jsf/html"
 xmlns:a4j="http://richfaces.org/a4j"
 xmlns:ig="http://es.infragistics.com/faces/netadvantage"
 style="width: 100%; border: 0px;">

<table width="100%" border="0" cellpadding="0" cellspacing="0">
 <tr>
  <td>
  <div style="height: 204px; width: 726px; overflow-x: auto;">
  <ig:gridView
   id="myGrid" binding="#{gridbean.myGrid}"
   dataSource="#{gridbean.gridDataModel}"
   pageSize="0" sortingMode="multi" resizableColumns="true"
   columnHeaderStyleclass="igGridColumnHeader" style="height:204px;width: 726px;">
.

.


And my bean code is


import  com.infragistics.faces.shared.enumeration.ExportFormat;

import com.infragistics.faces.shared.enumeration.DataToExport;

import  com.infragistics.faces.grid.component.GridView;

 
private GridView myGrid= new GridView();
private ListDataModel gridDataModel;
 

with its getter and setter


But while ruuning the page its getting cust call exception,

could anyabody plz help why it is happening?

If I use  import com.infragistics.faces.grid.component.html.HtmlGridView; 
 then its working fine, but while going to export the data its showing exception again.

 

  • 1765
    Suggested Answer
    posted

    Hello Gantait,

    Yes!! we receive 'ClassCastExcpetion', if we try to initialize new GridView object in backing bean i.e. 'Private GridView myGrid= new GridView();'. Instead just declare 'Private GridView myGrid;' and generate Getters and setters.

    Thank you!

    Swetha