Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • Blama
    replied
    Your goal is:
    • ListGrid edit mode: 2-value dropdown with current value selected -> editorProperties
    • filterrow: 2-value dropdown -> filterEditorProperties
    • ListGrid display mode: Strings "Yes", "No" -> IMHO setValueMap and cellFormatter both will work.
    Also the DS-Field in the underlying DataSource should be type="boolean".

    Best regards
    Blama

    Leave a comment:


  • mtmattek
    replied
    a real dumb question.. i tried changing it to a checkbox just to see if it worked and it ONLY changed the header/filter bar appearance, not the grid. Am i missing something obvious here? do I need a cell formatter?

    Leave a comment:


  • mtmattek
    replied
    no dice.. set it on both (tried using a new Map, just to be sure).

    Leave a comment:


  • Blama
    replied
    One one the SelectItem, one on the ListGridField itself.
    I don't know if it causes a problem if you reuse the same object here.

    Leave a comment:


  • mtmattek
    replied
    ok.. no difference there. guess I will try to post a case. Just to be clear, there is only one value map (on the select item), correct?

    Thanks so much for your help, btw :)

    Leave a comment:


  • Blama
    replied
    Yes, that is that I meant. What happens if you change
    Code:
    LinkedHashMap<Boolean, String> activeValueMap= new LinkedHashMap<>(2);
    LinkedHashMap<Boolean, String> activeValueMap= new LinkedHashMap<[B]Boolean, String[/B]>(2);
    for both valueMaps? If that does not work, you should create a testcase for Isomorphic to check (also mention your version+build then).

    Best regards
    Blama

    Leave a comment:


  • mtmattek
    replied
    yepp.. its close.. i get the INITIAL values as true/false. but when I click the box, I get No/Yes/No. Here's what I want. a drop down with Yes or No displayed initially, then the other option in a drop down.

    Code:
    SelectItem editor= new SelectItem();
    
                            final LinkedHashMap<Boolean, String> activeValueMap= new LinkedHashMap<>(2);
                            activeValueMap.put( true, "Yes");
                            activeValueMap.put(false, "No");
                            editor.setValueMap(activeValueMap);
                        
                            newField.setCanToggle(false);
                            newField.setEditorProperties(editor);

    hmm
    .

    Leave a comment:


  • Blama
    replied
    Almoste there.

    Create the ComboBoxItem/SelectItem with its valueMap and set it to the field as editor via setEditorProperties().

    Best regards
    Blama

    Leave a comment:


  • mtmattek
    replied
    yeah.. sorry.. didn't post that.. here's the code:

    Code:
    ListGridField newField = new ListGridField(attributeName,record.getAttribute("DisplayName"));
    newField.setAlign(Alignment.LEFT);
    newField.setCellAlign(Alignment.LEFT);
    if (TagTemplatesFieldNames.TAG_TEMPLATE_KEY.toString().equals(attributeName)){
    newField.setAttribute("primaryKey", true);
    
    
    } else if (TagTemplatesFieldNames._ACTIVE.toString().equals(attributeName)){
    newField.setCanToggle(false);
    final LinkedHashMap<Boolean, String> activeValueMap= new LinkedHashMap<>(2);
    activeValueMap.put( true, "Yes");
    activeValueMap.put(false, "No");
    newField.setValueMap(activeValueMap);
    }
    if (!record.getAttributeAsBoolean("Editable")){
    newField.setCanEdit(false);
    }
    gridFields.add(newField);

    Leave a comment:


  • Blama
    replied
    If newField is a ListGridField, which I assume now because of the setCanToggle(false), you'll need to pass a ComboBoxItem/SelectItem as editorProperties.
    Your goal is to have a Yes/No dropdown in edit mode instead of a CheckBox, correct?

    Best regards
    Blama

    Leave a comment:


  • mtmattek
    replied
    well, now I get true or false with no other option...

    the data is def. boolean:
    copied from the RPC call gwtconsole:


    active:false,

    also (edit).. there's something in the GWTconsole:

    12:55:12.970:XRP5:WARN:Log:JSO::convertMapToJavascriptObject : Value maps can only map from integral or String stored key values to String display values. Key true is not allowed.
    12:55:12.971:XRP5:WARN:Log:JSO::convertMapToJavascriptObject : Value maps can only map from integral or String stored key values to String display values. Key false is not allowed.
    Last edited by mtmattek; 14 Sep 2016, 09:58.

    Leave a comment:


  • Blama
    replied
    Hi mtmattek,

    this sounds like a datatype problem.
    It would happen if you value is "No", because the values of your Dropdown are the Strings "true" and "false".
    This needs to match, e.g.:
    Code:
    final LinkedHashMap<Boolean, String> activeValueMap= new LinkedHashMap<Boolean, String>(2);
    activeValueMap.put(true, "Yes");
    activeValueMap.put(false, "No");
    Then use a Boolean value for the real data.

    If you are using Strings and want to keep it that way try this:
    Code:
    final LinkedHashMap<String, String> activeValueMap= new LinkedHashMap<String, String>(2);
    activeValueMap.put("Yes", "Yes");
    activeValueMap.put("No", "No");
    Best regards
    Blama

    Leave a comment:


  • mtmattek
    started a topic Drop Down box shows current value as well?

    Drop Down box shows current value as well?

    so I get a drop down with Yes/No, but if "no" is selected and user selects, they get "No/Yes/No" in other words, No is already selected it should not be a choice.

    it does have a value map?
    newField.setCanToggle(false);
    final LinkedHashMap<String, String> activeValueMap= new LinkedHashMap<>(2);
    activeValueMap.put("true", "Yes");
    activeValueMap.put("false", "No");
    newField.setValueMap(activeValueMap);
Working...
X