Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Change language of grid column configuration items

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default Answered: Change language of grid column configuration items

    Hi all,

    in GXT 3 there is a simple possibility to configure the columns of a grid (sort ascending, descending, hide/show columns...).
    Is there a way to change the texts of these configurations at runtime? In the datepicker there is a way to do this with datePicker.setMessages(datepickerMessages).

    Thanks in advance,
    Holger Herrmann

  2. Thank you Andy, thank you Andreas, I finally found a solution.

    I found the code lines where the texts are set: GridView, lines 1220, 1233 and 1247.
    So I made a custom class MyGridView (and MyLiveGridView) that inherits from GridView, contains the user language specific strings and overwrites the method createContextMenu.

  3. #2
    Sencha User
    Join Date
    May 2014
    Posts
    11
    Answers
    1

    Default

    You can, of course, use ColumnConfig#setHeader ... are you trying to add different header values to the header context menu? If you are trying to support multiple languages for your application then I recommend that you investigate the GWT internationalization.

  4. #3
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default

    Hi Andy,
    thank you for your answer.
    I'm not sure if you got me right. I don't want to change the header of the columns (that is no problem). The thing we want to change are the two or three entries when changing the column definition in the application (e.g. "Sort ascending" by clicking on the small arrow beside the columns).
    Can this also be changed by setHeader? But which header should be changed?

  5. #4
    Sencha User
    Join Date
    May 2014
    Posts
    11
    Answers
    1

    Default

    Well, you could get the menu entries using Container#iterator (the Menu class extends InsertContainer which extends Container). You could then change the element value for each of the child Widgets in the menu. For example, here's the menu entry for "Sort Ascending":

    Code:
    <span class="GMFEK3RHFC" unselectable="on">Sort Ascending<img ...></span>
    I don't know whether this is a reasonable approach to this! My feeling is that Sencha would have a way to do this using the internationalization features.

  6. #5
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223
    Answers
    5

    Default

    Holger, tell us about your intention to change GridColumnHeaderMenuEntries. Best approach to do so depends on your circumstances.

    Are you trying to change *some* entries, maybe depending on some other things?
    Or are you trying to change *all* entries in every GridColumnHeaderMenu?

    Ladder one is clearly a localization issue.

  7. #6
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default

    Yes, I want to change all entries.

    In our application, the user can select the desired language at login time. We have to change all texts depending on this selection, so also for the texts in the grid column menu (it's only "Sort ascending", "Sort descending" and "Columns").

    In the date picker, this is easily solved by providing the method setMessages(DatePickerMessages).
    In a grid, I can't see a thing like this.

  8. #7
    Sencha User
    Join Date
    May 2014
    Posts
    11
    Answers
    1

    Default

    Did you understand my response about iterating through the elements and replacing the element values? If this isn't clear then I'll try to show some code to explain it.

  9. #8
    Sencha User
    Join Date
    Jul 2011
    Location
    Germany
    Posts
    223
    Answers
    5

    Default

    Quote Originally Posted by Holger Herrmann View Post
    Yes, I want to change all entries.

    In our application, the user can select the desired language at login time. We have to change all texts depending on this selection, so also for the texts in the grid column menu (it's only "Sort ascending", "Sort descending" and "Columns").

    In the date picker, this is easily solved by providing the method setMessages(DatePickerMessages).
    In a grid, I can't see a thing like this.
    hh, setting translated text for each element seems cumbersome. You clearly have to google "GWT Internationalization"!
    GXT delivers translation for most of its elements in several languages. I hope you figured that out already and use them for datePicker.setMessages(DatePickerMessages). Or are you providing your own translation?!

  10. #9
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default

    Yes, we have our own translation. Our customers can change all texts and translations for all his languages by doing his own customizer (we have developed a web customizer and an eclipse plugin for doing this).

  11. #10
    Sencha Premium Member
    Join Date
    Jun 2013
    Location
    Nuremberg, Germany
    Posts
    88
    Answers
    3

    Default

    Thank you Andy, thank you Andreas, I finally found a solution.

    I found the code lines where the texts are set: GridView, lines 1220, 1233 and 1247.
    So I made a custom class MyGridView (and MyLiveGridView) that inherits from GridView, contains the user language specific strings and overwrites the method createContextMenu.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •