Hi,
  I need to create AjaxFallbackDefaultDataTable with dynamical columns. I am 
reading columns from database and creating AjaxFallbackDefaultDataTable with 
this info. I have classes DataTable and DataRow like .net's data layer 
structure. DataTable have DataRows in ArrayList and DataRows have DataColumns 
in ArrayList. I am defining DataRow as modelObject. I am reaching column value 
like this: 
  ((DataRow)dataTable.getRow(rowIndex)).get/String/Decimal/Date("columnName");.
  Wicket searching set/getColumnName() in the modelObject and these classes and 
functions have been finalized. It looks like, there is no way to create 
dataTable with dynamical columns. If any way you know can you explain?
   
  -------------------------------
  I am taking this error:
  WicketMessage: No get method defined for class: class com.elf.data.DataRow 
expression: id
  Root cause:
  org.apache.wicket.WicketRuntimeException: No get method defined for class: 
class com.elf.data.DataRow expression: id
   
  I have codes like these:
  ElfAjaxDataGrid helpDataGrid = new 
ElfAjaxDataGrid("helpDataGrid",help.columns(),help.dataProvider(),50);
   
   
  public ArrayList columns(){
//normally I am reading from db
   ArrayList columns = new ArrayList();
 columns.add(new PropertyColumn(new Model("ID"), "id"));
 columns.add(new PropertyColumn(new Model("First Name"), "firstName", 
"firstName"));
 return columns;
}
   
  public HelpDataProvider dataProvider()throws Exception{
//normally I am reading from db
   DataTable dataTable = new DataTable("helpDataTable");
 dataTable.checkAndAddColumn(new StringDataColumn(dataTable,"id"));
 dataTable.checkAndAddColumn(new StringDataColumn(dataTable,"firstName"));
 DataRow dataRow = dataTable.NewRow();
 dataRow.set("id", "1");
 dataRow.set("firstName", "test");
 dataTable.AddRow(dataRow);
 return new HelpDataProvider(dataTable);
}
   
  public class HelpDataProvider extends SortableDataProvider{
 private static final long serialVersionUID = 1L;
 DataTable dataTable = null;
 
 public HelpDataProvider(DataTable dataTable) {
  this.dataTable = dataTable;
 }
 
 public Iterator iterator(int first, int count) {
  return dataTable.rows().iterator();
 }
   public IModel model(Object object) {
  return new HelpDetachableModel(dataTable);
 }
   public int size() {
  return dataTable.Count();
 }
}
   
  public class HelpDetachableModel extends LoadableDetachableModel{
 private static final long serialVersionUID = 1L;
 private int index = 0;
 private DataTable dataTable;
 
 public HelpDetachableModel(DataTable dataTable) {
  this.dataTable = dataTable;
 }
 
 protected Object load() {
  return dataTable.getRow(index);
 }
}

       
---------------------------------
Yahoo! kullaniyor musunuz?
Istenmeyen postadan biktiniz mi? Istenmeyen postadan en iyi korunma Yahoo! 
Posta'da
http://tr.mail.yahoo.com

Reply via email to