Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2775 connectés 

  FORUM HardWare.fr
  Programmation
  Java

  [SmartGwt] Fields cannot be added to a DataSource after the underlying

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[SmartGwt] Fields cannot be added to a DataSource after the underlying

n°2006565
blured
Posté le 02-07-2010 à 11:23:23  profilanswer
 

Bonjour,
 
En essayant de rendre ma datasource Rest dynamique afin de créer les colonnes (champs) suivant le contenu de cette DS, j'obtiens l'erreur
 

Code :
  1. Fields cannot be added to a DataSource after the underlying component has been created


 
Voici le code de ma DataSource

Code :
  1. public class ViewDataSource2 extends RestDataSource {
  2. @Override 
  3.     protected Object transformRequest(DSRequest dsRequest) { 
  4.         return super.transformRequest(dsRequest); 
  5.     } 
  6.     @Override 
  7.     protected void transformResponse(DSResponse response, DSRequest request, Object data) {
  8.   
  9.      super.transformResponse(response, request, data); 
  10.    
  11.     String toto = XMLTools.selectString(data, "@name" );
  12.   
  13.     toto = "pouet : " + toto;
  14.      
  15.   DataSourceTextField phoneField = new DataSourceTextField("name", "Phone" ); 
  16.       phoneField.setValueXPath("@name" );
  17.       System.out.println("getFields : "  + getFields());
  18.       ArrayList<DataSourceField> list = new ArrayList<DataSourceField>();
  19.       for (int i = 0 ; i < getFields().length ;i++) {
  20.        list.add(getFields()[i]);
  21.       }     
  22.       list.add(phoneField);
  23.      
  24.       setFields(list.toArray(new DataSourceField[list.size()]));
  25.     }


 
Voici le code de ma classe utilisant cette datasource

Code :
  1. ViewDataSource2 dataSource = new ViewDataSource2();                   
  2. dataSource.setDataFormat(DSDataFormat.XML); 
  3.                
  4. dataSource.setRecordXPath("//wky:column" );   
  5. dataSource.setDataURL("/helloworld/workeyapirestproxy?url=http://localhost:8080/workey-j2ee-api/View/1&login=test1&password=test" );
  6.                
  7.                
  8.                       final ListGrid countryGrid = new ListGrid(); 
  9.                      
  10.                   countryGrid.setWidth100(); 
  11.                   countryGrid.setHeight100();
  12.                   countryGrid.setDataSource(dataSource);
  13.                   countryGrid.setAutoFetchData(true);
  14.                              ....


 
J'ai posté ça sur le forum de smartgwt mais je n'ai eu aucune réponse pour l'instant.
 
A priori mon besoin d'avoir une datasource avec des champs dynamiques semble compliqué à réaliser ... :(  
 
J'ai tenté avec une définition directe de Record[] sur l'objet countryGrid ceci dit dans ce cas les filtres ne fonctionnent pas c'est pour celà que je me suis rabatu sur les datasource qui est la méthode recommandé mais qui semble assez inflexible pour la définition de colonnes dynamiques. Si vous avez la moindre solution je suis preneur :)
 
Blured.

mood
Publicité
Posté le 02-07-2010 à 11:23:23  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  Java

  [SmartGwt] Fields cannot be added to a DataSource after the underlying

 

Sujets relatifs
LINQ to sql exception : The underlying connection was closed...GWT - smartGWT : formatter & mask sur composant ComboBoxItem
Erreur de compilation Java "cannot find symbol" sous ubuntu 9.04Cannot modify header information - headers already sent by
Méthode find et propriété after[Java] binding objet JAVA -> XML pour Datasource GWT
"cannot find symbol" d'un symbole défini...[JS] Problème: ""null":Cannot convert undefined or null to object"
Cannot send session cookie et Cannot send session cache limiterCannot resolve file j_spring_security_check
Plus de sujets relatifs à : [SmartGwt] Fields cannot be added to a DataSource after the underlying


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR