Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8550817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:02:49+00:00 2026-06-11T14:02:49+00:00

To expand my question, you could say that I want to program in SmartGWT

  • 0

To expand my question, you could say that I want to program in SmartGWT instead of programming into SmartGWT ( http://msmvps.com/blogs/jon_skeet/archive/2008/04/23/programming-quot-in-quot-a-language-vs-programming-quot-into-quot-a-language.aspx ).

I have a 2 column ListGrid, populated with data from the 5 column database table. I don’t use a DataSource (more on that later), instead I get the data from the async service and populate it on success like this predmetiGrid.setData(PredmetRecord.convertToContractRecordArray(result)); . The user can edit the data and press the Save button to save it. The way I have implemented the save is:

// repeat this for each edited field 
for (int i=0; i < predmetiGrid.getAllEditRows().length; i++){

        int editedRowIndex = predmetiGrid.getAllEditRows()[i];

        // for each edite get the full record

        PredmetRecord editedRecord = (PredmetRecord)predmetiGrid.getRecord(editedRowIndex);

        // create a new DomainObject - Predmet, and set the ID from the 
        // Row so I have the ID to use for update later

        Integer predmetID = editedRecord.getAttributeAsInt("predmetID");
        Predmet predmet = new Predmet(predmetID);

        // fill Predmet object with either the edited value, or the
        // original value (if only one of the fields was changed and not both)

        String editedNazivPredmeta = (String)predmetiGrid.getEditValues(editedRecord).get("nazivPredmeta");
        boolean isNazivChanged = editedNazivPredmeta != null;
        if (!isNazivChanged){
            editedNazivPredmeta = editedRecord.getAttribute("nazivPredmeta");
        } 
        predmet.setNazivPredmeta(editedNazivPredmeta);

        String editedOpisPredmeta = (String) predmetiGrid.getEditValues(editedRecord).get("opisPredmeta");
        boolean isOpisChanged = editedOpisPredmeta != null;
        if (!isOpisChanged){
            editedOpisPredmeta = editedRecord.getAttribute("opisPredmeta");
        }
        predmet.setOpisPredmeta(editedOpisPredmeta);

        predmetiList.add(predmet);

    }

In another method I call the async service:

public void updatePredmeti(List<Predmet> predmeti) throws RpcException, IllegalArgumentException {

    for (int i=0; i<predmeti.size();i++){
        JdbcPredgledPredmetaDAO.getInstance().updatePredmet(predmeti.get(i));
    }

}

Now there are a few problems with this implementation. The most obvious ones are:

a) I’m not using a Datasource conected with the ListGrid. I don’t use it because I don’t understand how to use it in my case since the examples are written either for an XML DataSource or for the SmartGWT Pro (or higher) integrated server.

b) The async method needs to have a rollback mechanism if one of the inserts fail, though there could be a smarter implementation of this (e.g. do all inserts in one transaction).

c) I’m “hacking” to get and update the data instead of using object methods/properties but this is, currently, the best I got form the JavaDoc; I’d prefer to see best practice way to write this and learn

I’m using SmartGWT LGPL 3.0, Tomcat 7.0, Java 1.6

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:02:50+00:00Added an answer on June 11, 2026 at 2:02 pm

    You can use a custom Datasource. DataSource.setDataFormat(DSDataFormat.CUSTOM). With this setting the DataSource will not handle the response, instead you have to parse it with transformResponse().

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to expand on the functionality related to this question . Is there
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
I want to expand my programming horizons to Linux. A good, dependable basic toolset
I have a method that I want to expand (rather than writing a new
I just had a question about aligning two expand-collapse boxes and got an answer
I want to expand the SSRS report automatically when click export button of excel
This question could easily take multiple paths, so I will hit the more specific
I asked a similar question previously, but it was so vague that I couldn't
I would like to expand on this question in terms of performance. The db
This could be a composite question, as I may not fully understand the issue.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.