Results 1 to 5 of 5

Thread: GridRowEditing on custom object column

  1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default GridRowEditing on custom object column

    Hi forum!
    So far I'm having this issue with GridRowEditing: I setup the editor for all the relevant columns and I'm excluding a column based on a POJO and rendered with an XTemplate.
    The problem is when I edit a row I get this :


    RowEditor.jpg

    As you can see first columns (simple Data,String or Double and handled by the editor) are fine but the last is shown with (I suppose) the Object.toString() of the POJO in the cell.
    Now, I don't blame this since I get the logic behind, but I'm asking for a nice&good way to overcome this and put there what is currently rendered in the cell (I recall, with XTemplate).

    Thank you in advance for any tip!

    EDIT:
    I tried a fast implementation of a Field<POJO> but failed, maybe I should work more on that, but I had more to do and stopped. Any advice here whould also be so appreciated.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    You are missing only one small step.

    If i am reading the code right, you just need to setup a Converter for this ColumnConfig.
    This Converter will convert your value to the String representation that you require.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default

    Hi Sven!

    I saw that "converter" stuff but my concern is that I don't just need a String rappresentation of my customObject, actually I need to show that rappresentation trought an XTemplate like I have in my cell (so I have an SafeHTML object).

    Onestly I did not tried to put a "SafeHTML.toString()" though a Converter there, that should work?
    I'm going to try, anyway.

    Thanks.

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976

    Default

    You will need to call asString (not toString).

    However there is another issue. Take a look at the doStartEditing method. Fields without an editor are using the Label widget. However the label widget will escap your html and so the markup is not really visible as you expect. The only solution for this is to extend GridRowEditing and change the doStartEditing method to use not Label, but another widget, like HTML

  5. #5
    Sencha Premium Member
    Join Date
    Nov 2012
    Location
    Cremona Italy
    Posts
    37

    Default

    Quote Originally Posted by sven View Post
    You will need to call asString (not toString).

    However there is another issue. Take a look at the doStartEditing method. Fields without an editor are using the Label widget. However the label widget will escap your html and so the markup is not really visible as you expect. The only solution for this is to extend GridRowEditing and change the doStartEditing method to use not Label, but another widget, like HTML
    I saw that, but I hoped there was another way to put html in there.
    That's nasty, but if it's needed...

    Thank you so much Sven!

Posting Permissions

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