Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    3
    Vote Rating
    0
    ManoloComo is on a distinguished road

      0  

    Default Unanswered: Dynamic Grid in GXT 3.0

    Unanswered: Dynamic Grid in GXT 3.0


    I have to create a basic grid:

    DataProperties dp = GWT.create(DataProperties.class);


    List<ColumnConfig<Data, ?>> ccs = new LinkedList<ColumnConfig<Data, ?>>();
    ccs.add(new ColumnConfig<Data, String>(dp.name(), 200, "Name"));
    ccs.add(new ColumnConfig<Data, String>(dp.value(), 200, "Value"));
    ColumnModel<Data> cm = new ColumnModel<Test.Data>(ccs);


    ListStore<Data> s = new ListStore<Test.Data>(dp.key());
    s.add(new Data("name1", "value1"));
    s.add(new Data("name2", "value2"));
    s.add(new Data("name3", "value3"));
    s.add(new Data("name4", "value4"));


    Grid<Data> g = new Grid<Data>(s, cm);


    RootPanel.get().add(g);


    ////////////////////////////////////


    public interface DataProperties extends PropertyAccess {
    @Path("name")
    ModelKeyProvider key();
    ValueProvider<Data, String> name();
    ValueProvider<Data, String> value();
    }


    public class Data {
    private String name;
    private String value;


    public Data(String name, String value) {
    super();
    this.name = name;
    this.value = value;
    }
    public String getName() {
    return name;
    }
    public String getValue() {
    return value;
    }
    public void setName(String name) {
    this.name = name;
    }
    public void setValue(String value) {
    this.value = value;
    }
    }



    To do it I need of:
    1)a model(Data);
    2)an interface(DataProperties) that extends PropertyAccess,
    3)a ListStore (a container populated with the model,the ColumnConfig,the ColumnModel).
    It establishes the relationship between the table and the model.


    I would want to create that four elements(DataProperties,ListStore,ColumnConfig,ColumnModel) in a generic way so I can reuse them in another model.Is there a way to do it?

    Thanks

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    87
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    You do not need to use PropertyAccess to create grids, or anything in GXT. PropertyAccess is just a way to look at bean-like models, and provide access to ValueProviders, ModelKeyProviders, and LabelProviders within those beans. Often, if you have a dynamic data model, you can make your own such provider implementations that can generically read from your data model.

    Check out the ValueProvider section of this blog post http://www.sencha.com/blog/building-gxt-charts/ for a discussion on how to make a very dynamic data model and how to make ValueProviders that can read them. The example is made for Charts, but the same principle applies for Grids as well.

  3. #3
    Sencha User
    Join Date
    Jan 2013
    Posts
    3
    Vote Rating
    0
    ManoloComo is on a distinguished road

      0  

    Default


    Thanks for you reply but I still have the problem.
    I don't know how create a my implementation of ValueProvider.


    My model:


    public class User extends GenericObj implements Serializable {
    private String userId;
    private String password;
    public String getUserId() {
    return userId;
    }
    public void setUserId(String userId) {
    this.userId = userId;
    }
    public String getPassword() {
    return password;
    }
    public void setPassword(String password) {
    this.password = password;
    }
    }


    My UserProperties:


    public interface UserProperties extends PropertyAccess<User> {
    @Path("name")
    ModelKeyProvider<User> key();
    ValueProvider<User, String> userId();
    ValueProvider<User, String> password();
    }


    MyView:


    private UserProperties userProperties = GWT.create(UserProperties.class);
    List<ColumnConfig<User, ?>> ccs = new LinkedList<ColumnConfig<User, ?>>();
    //my problem is here...
    ccs.add(new ColumnConfig<User, String>(userProperties.password(), 200, ""));
    ccs.add(new ColumnConfig<User, String>(userProperties.userId(), 200, ""));
    ....


    I'd want to create something as this:


    List<ColumnConfig<GenericObj, ?>> ccs = new LinkedList<ColumnConfig<GenericObj, ?>>();
    //for all fields of GenericObj
    ccs.add(new ColumnConfig<GenericObj, String>(*something that substitute the bold line*, 200, ""));


    Can I do it?
    Thanks in advice, Manolo

  4. #4
    Sencha User
    Join Date
    Aug 2013
    Posts
    7
    Vote Rating
    0
    pvuppala is on a distinguished road

      0  

    Default


    Hi Manalo,
    Were you able to figure out how to implement. Even I'm looking for something like this.Please let me know.

    Thanks
    pvuppala

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    87
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    The basic idea here is to make a custom ValueProvider that does the work of combining those two other values into one. Remember that ValueProvider is just an interface - you don't need to rely on PropertyAccess to make instances for you.

    Code:
    ValueProvider<MyClass, String> customValueProvider = new ValueProvider<MyClass, String>() {
      public String getValue(MyClass object) {
        return object.getFoo() + " " + object.getBar();//put your own logic here 
      }
      public void setValue(MyClass object, String value) {
        //what happens if the user edits a value? This is how you save that value to one or both fields as needed
        //if not possible, you can leave this blank
      }
      public String getPath() {
        //this should return a string that identifies the property that is shown. If you have server-side
        //sorting or filtering, this will be used to identify this column to the server.
        return "foo+bar";
      }
    }

  6. #6
    Sencha User
    Join Date
    Aug 2013
    Posts
    7
    Vote Rating
    0
    pvuppala is on a distinguished road

      0  

    Default


    List<ColumnConfig<User, ?>> ccs = new LinkedList<ColumnConfig<User, ?>>();
    //my problem is here...
    ccs.add(new ColumnConfig<User, String>(userProperties.password(), 200, ""));
    ccs.add(new ColumnConfig<User, String>(userProperties.userId(), 200, ""));

    If I wanted to have something like above, then I should be creating two customvaluproviders one for "password" other for "userId".Is my understanding right

    that is

    ValueProvider<MyClass, String> pwdValueProvider = new ValueProvider<MyClass, String>() {
    public String getValue(MyClass object) {
    return object.getPassword()
    }
    ....
    ....
    ...
    }

    ValueProvider<MyClass, String> userIdValueProvider1 = new ValueProvider<MyClass, String>() {
    public String getValue(MyClass object) {
    return object.getUserId()
    }
    ....
    ....
    ...
    }

    ccs.add(new ColumnConfig<User, String>(pwdValueProvider, 200, ""));
    ccs.add(new ColumnConfig<User, String>(userIdValueProvider1, 200, ""));

    Correct?

  7. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    87
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Do you want two columns for these two properties? Then make two columns and use the PropertyAccess as documented.

    My explanation was for how to merge two columns into one, and how to make a ValueProvider that combines data from both of those into one - that is what the original discussion was about, and you said you were looking for something like that.

Thread Participants: 2

Tags for this Thread