1. #1
    Sencha User
    Join Date
    Jul 2009
    Posts
    16
    Vote Rating
    0
    sajjan.sarkar is on a distinguished road

      0  

    Question Unable to set Template on ListField

    Unable to set Template on ListField


    Hi,
    I'm new to GXT and apologize in advance if my question is a repeat( I couldnt any similar questions though).

    I'm trying to build a listfield of Approvers, but want to display in the format "LastName,FirstName".
    Here is my Approver stub:
    Code:
    /** * 
     */
    package com.peoplenet.OrderEntry.client;
    
    
    import com.extjs.gxt.ui.client.data.BaseModelData;
    /**
     * @author sajjan sarkar
     *
     */
    public class Approver extends BaseModelData{
            
        private static final String userID = "userID";
        private static final String firstName = "firstName";
        private static final String lastName = "lastName";
        
    
    
        public Approver()
        {
            super();
        }
        
        public int getUserID() {
            return get(userID);
        }
    
    
        public void setUserID(int userID) {
            set(Approver.userID,userID);
        }
    
    
        public int getFirstName() {
            return get(firstName);
        }
    
    
        public void setFirstName(int firstName) {
            set(Approver.firstName,firstName);
        }
    
    
        public int getLastName() {
            return get(lastName);
        }
    
    
        public void setLastName(int lastName) {
            set(Approver.lastName, lastName);
        }
    }
    And here is my listfield code:
    Code:
    ....
    approversListField = new ListField<Approver>();        
    approversListField.setEmptyText("employee last name");         
            approversListField.setTemplate("{lastName},{firstName}");
            approversListField.setDisplayField("lastName");  
            approversListField.setFieldLabel("Approvers *");            
            approversListField.setId("approvers");
            approversListField.setStore(dataStores.getApprovers());
    • When I remove the setTemplate call I can see the LastNames of the employees, so I do have the data.
    Please let me know what I'm missing out!
    Thanks a lot!
    ......

  2. #2
    Sencha User
    Join Date
    Jul 2009
    Posts
    16
    Vote Rating
    0
    sajjan.sarkar is on a distinguished road

      0  

    Cool SOLVED: Specify javascript HTML template

    SOLVED: Specify javascript HTML template


    Hi,

    Found the solution myself.. this worked
    Code:
    private void loadApprovers() {        
            approversListField = new ListField<Approver>();
            approversListField.setEmptyText("employee last name");     
            approversListField.setTemplate(getTemplate());        
            approversListField.setFieldLabel("Approvers *");            
            approversListField.setId("approvers");
            approversListField.setStore(dataStores.getApprovers());
        }
        private native String getTemplate() /*-{
        return  [
        '<tpl for=".">',
        '<div class="x-combo-list-item" qtip="{userID}" qtitle="UserID:">{lastName},{firstName}</div>',
        '</tpl>'
        ].join("");
      }-*/;

Tags for this Thread

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