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 7710227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:04:19+00:00 2026-06-01T01:04:19+00:00

I want to be able to render a Grid while the number of some

  • 0

I want to be able to render a Grid while the number of some extra columns are unknown until I’m in the onRender() method based on the type of a certain data.

I have this class

ActivityModel extends BaseDataModel {
  // defines all common setXXX and getXXX needed
}

my problem is that, coming back from the server side, the model carries also some extra fields which must be also rendered as columns within the Grid.

My question :
Is there a way to have a kind of Indexed fields within AcitivityModel to be able to do the following ? : focus on col.setId("{indexed}");

        List<ActivityParameterModel> parameters = folderModel.getParameters();
    for (ActivityParameterModel param : parameters) {
        ActivityParamType paramType = param.getParamType();
        col = new ColumnConfig();
        col.setHeader(param.getParamName());
        col.setWidth(2);
                    //
                    // the following line is what I'm expecting to do
        col.setId("{indexed}");
        switch (paramType) {
        case N:
            NumberField nf = new NumberField();
            nf.setPropertyEditorType(Integer.class);
            col.setEditor(new CellEditor(nf));
            break;
        case S:
            TextField<String> tf = new TextField<String>();
            col.setEditor(new CellEditor(tf));
            break;
        }
        config.add(col);
  • 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-01T01:04:20+00:00Added an answer on June 1, 2026 at 1:04 am

    here’s what I did to come up with the situation :

    I stored in DB the variable parameters, here’s the entity :

        @Entity
        @Table(name = "ACTIVITYPARAMETER")
        public class ActivityParameter implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @SequenceGenerator(name = "ACTIVITYPARAMETER_IDACTIVITYPARAMETER_GENERATOR",   sequenceName = "SN_ACTIVITYPARAMETER", 
        allocationSize = 1)
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ACTIVITYPARAMETER_IDACTIVITYPARAMETER_GENERATOR")
    @Column(name = "ID_ACTIVITYPARAMETER", unique = true, nullable = false)
    private Long idActivityParameter;
    
    @Column(nullable = false, length = 256)
    private String paramName;
    
    @Column(nullable = false, length = 256)
    private String paramType;
    
    // uni-directional many-to-one association to Activitysetting
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "ACTIVITYSETTING_ID", nullable = false)
    private ActivitySetting activitySetting;
    
    @Column(name = "PARAMORDER", nullable = false)
    private Long order;
    
    @Column(name = "PARAMMANDATORY", nullable = false, precision = 1)
    @TypeConverter(name = "booleanToNumberConverter", dataType = BigDecimal.class, objectType = Boolean.class)
    private boolean mandatory;
    

    at creation time of the grid, I created the fixed columns then I made a loop to build the variable parameters using simply set(paramName,DEFAULT_VALUE) as following :

            // Extra Fields
        List<ActivityParameterModel> parameters = folderModel.getParameters();
        int index = 1;
        for (ActivityParameterModel param : parameters) {
            String columnId = "param" + (index++);
            col = new ColumnConfig(columnId, param.getParamName(), 90);
            NumberField nf = new NumberField();
            col.setEditor(new CellEditor(nf));
            ActivityParamType paramType = param.getParamType();
            switch (paramType) {
            case N:
                nf.setValidateOnBlur(true);
                break;
            }
            config.add(col);
        }
    

    it creates the extra columns and at submit time, I restore the values by looping again over parameter list and calling the get(paramName) to restore the value.

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

Sidebar

Related Questions

i want to be able to take html code and render plain text out
I want to be able to make an HTTP call updating some select boxes
I want to be able to define templates once and use them to render
I'm making a 2D game. I want to be able to render a texture
I want to be able to use extra variables on a custom 404 template
I want to render some json data using HTML template. I haven't started implementing
I'm using LaTeX and BibTeX for an article, and I want to able to
Want to be able to provide a search interface for a collection of objects
I want to be able to random a value when a UIButton is pressed.
I want to be able to capture the exception that is thrown when a

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.