1. #1
    Ext GWT Premium Member
    Join Date
    Jul 2009
    Posts
    130
    Vote Rating
    1
    arkadye is on a distinguished road

      0  

    Default Unanswered: Can I use GWT JavaScript overlay type in data stores?

    Unanswered: Can I use GWT JavaScript overlay type in data stores?


    Hi,

    Is it possible to use GWT JavaScript overlay type (sub-class of the JavaScriptObject) with getters and setters in GXT 3.0 data stores?

    Thanks.

    Arkady.

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    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


    Yes - in GXT 3, any Java Object can be used in the stores. JSOs are Java Objects except for the detail that they have different rules about casting, and how they must be defined. The only requirements for any object to be put in a store is that a ModelKeyProvider instance must be defined for that object - and if the JSO has getters for a unique string for each instance, then that key provider can be generated with PropertyAccess.

    To be used in a data widget like a grid, the only requirement is that a ValueProvider (or sometimes a LabelProvider) be defined that can read data from the object. Again, if the JSO has getters and setters, PropertyAccess can be used to generate these, otherwise implement the interfaces to do as you need.

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    22
    Vote Rating
    0
    hrishirise is on a distinguished road

      0  

    Default Need help on same issue

    Need help on same issue


    Thanks , but can you let me know whats needs to be corrected in my case.

    When i use JSOverlays with XTemplates, it does not render any value. It just displays the variables as it is.
    I have added sample code below , please let me know. Especially where you see Value provider declared. Let me know, how value providers has to be mapped to JS Overlay getters please?



    Here is an example:
    JSOverlay Class:

    #Note there are no private variables or setters.

    public class UserData extends JavaScriptObject {
    protected UserData() {}
    public final native String getId() /*-{ return this.Id; }-*/;
    public final native String getUsername() /*-{ return this.Username; }-*/;
    public final native String getPhone() /*-{ return this.Phone; }-*/;
    }


    //ValueProvider interface. Here What should be member names? I have put lower case names by getter.

    public interface UserProperties extends PropertyAccess<UserData> {
    ModelKeyProvider<UserData> id();
    LabelProvider<UserData> username();
    }


    //List Store adding adding the returned overlay object.

    UserProperties userProp = GWT.create(UserProperties.class);
    ListStore<UserData> adUserStore = new ListStore<UserData>(userProp.id());
    adUserStore.add(user);

    Assuming i have done the render methods for XTemplate and i am rendering user object.

    Problem here.XTemplate.

    <div class=" {style.adPadding} ">{user.username}</div>

    "user.username" does not get resolved to any value. It just displays as it is.


    Please let me know your inputs.

    Regards,

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Answers
    109
    Vote Rating
    90
    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


    PropertyAccess instances have ValueProvider methods generated based on the existance of getter and setter methods, not the internals of the objects. XTemplates then leverage that same ValueProvider creation mechanism, so if one works, the other should as well (assuming capitalization is correct, and models actually have getters for the properties being used). Both systems should generate useful log messages, though some of the xtemplate logs are not as helpful as they could be.

    I took your class and xtemplate, and built a quick unit test method:
    Code:
      public static class UserData extends JavaScriptObject {
        protected UserData() {}
        public final native String getId() /*-{ return this.Id; }-*/;
        public final native String getUsername() /*-{ return this.Username; }-*/;
        public final native String getPhone() /*-{ return this.Phone; }-*/;
        }
      public interface UserProperties extends PropertyAccess<UserData> {
        ModelKeyProvider<UserData> id();
        LabelProvider<UserData> username();
        }
      public interface UserTemplate extends XTemplates {
        @XTemplate("<div class=\"{style}\">{user.username}</div>")
        SafeHtml wrap(String style, UserData user);
      }
      public void testJavaScriptObject() {
        UserTemplate template = GWT.create(UserTemplate.class);
        
        UserData data = JsonUtils.safeEval("{\"Id\":\"123\",\"Username\":\"Colin Alworth\"}");
        SafeHtml wrapped = template.wrap("cssClassName", data);
        String wrappedHtml = wrapped.asString();
        assertTrue(wrappedHtml.contains("Colin Alworth"));
      }
    This test passes, so something may be wrong with the XTemplate method you declared. Can you post a full example that doesn't work so I can see what might be wrong, and what errors (if any) are generated?

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi