junaidp
junaidp

Reputation: 11201

SmartGwt: how to fetch the data in my listgrid

i have a list grid ,i am assiging the values to listGrid by some method in my app

like this

               private ListGridRecord[] getData(UserRecord selectedClient) { 

        return new ListGridRecord[]{  
                new NameValueRecord(1, "US Siren", selectedClient.getClientsId()),  
                new NameValueRecord(2, "EN: Liste des identifiants", selectedClient.getClientId2()),  
                new NameValueRecord(3, "Account number", selectedClient.getClientId3()),  
                new NameValueRecord(4, "Partner number", selectedClient.getClientId4()),  
                new NameValueRecord(5, "REGON", selectedClient.getClientId5()),  
                new NameValueRecord(6, "US Siren*", selectedClient.getClientId6()) , 
                new NameValueRecord(7, "TEST", selectedClient.getClientId7())  
        };  
    }

It works fine for me and shows the given values in the grid when the app runs .

Now i want to get these values which are displaying in the grid (Which user can also edit from the grid)

I can get the edited values like this

                clientIdsGrid.setEditorCustomizer(new ListGridEditorCustomizer() {  
            public FormItem getEditor(ListGridEditorContext context) {  
                ListGridField field = context.getEditField();  
                if (field.getName().equals("value")) {  
                    NameValueRecord record = (NameValueRecord) context.getEditedRecord();

But if a user dont even click on any record and just click save to save the values as it is.

How can i then get the data which is in my grid .

I am trying these

                 clientIdsGrid.getRecord(1);
          clientIdsGrid.getRecords();

but this gives me a listGrid/listGridRecord , how can i then fetch the individual data on each row from them .

Upvotes: 0

Views: 2896

Answers (1)

Dodji
Dodji

Reputation: 80

grid.addEditorExitHandler may help. Within it u can use:

grid.getEditValueAsString(row num, Column name) for getting new edited value. If no new it will return null.

Upvotes: 0

Related Questions