1. #1
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Answers
    8
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default Answered: Grid - How to get rendered data in view

    Answered: Grid - How to get rendered data in view


    Hello everyone,

    I'm trying to get all rendered data in the grid. Before Ext JS 4.x, we could do this with using selection model.
    Now I wasn't able to find a suitable method for this. I'm trying this way instead of getting data from store because of
    I've some rendered lookup values to offer user-friendly description.

    I'll be happy if someone can help me.
    Thanks in advance.
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

  2. Quote Originally Posted by talha06 View Post
    Let me give you an example of my situation:
    If I use converter, I'll loss these key values which I need to use for further actions on grid.
    ...
    Please correct me if there's something wrong.
    Only if you covert the key values in place. Instead convert them into a new field:

    Code:
    fields: {
     { name: 'gender',  type: 'int' },
     { name: 'genderText', type: 'string', convert: function (value, record) {
      return 1 == record.get ('gender') ? 'male' : 'female';
     } }
    }
    Now you have both the key and the text in the model. Your grid, and wherever else, can use genderText but you still have the number.

  3. #2
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      1  

    Default


    If you need the converted data you should do the conversation in the model with 'convert' instead of in the grid with 'render'.

    Your data is in the model, you shouldn't be pulling it from the screen.

  4. #3
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Answers
    8
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default


    Quote Originally Posted by James Goddard View Post
    If you need the converted data you should do the conversation in the model with 'convert' instead of in the grid with 'render'.

    Your data is in the model, you shouldn't be pulling it from the screen.
    Let me give you an example of my situation:
    I've a grid for users. And I store user's sex as integers like 1,2.
    If I use converter, I'll loss these key values which I need to use for further actions on grid.
    So I'll use another field to store these numeric key values. This means we keep same value twice.
    But the rendered data isn't used most times. For example I need these rendered values for a generic export mechanism that I'm implementing nowadays.

    Please correct me if there's something wrong.
    Thanks.
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

  5. #4
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      0  

    Default


    Quote Originally Posted by talha06 View Post
    Let me give you an example of my situation:
    If I use converter, I'll loss these key values which I need to use for further actions on grid.
    ...
    Please correct me if there's something wrong.
    Only if you covert the key values in place. Instead convert them into a new field:

    Code:
    fields: {
     { name: 'gender',  type: 'int' },
     { name: 'genderText', type: 'string', convert: function (value, record) {
      return 1 == record.get ('gender') ? 'male' : 'female';
     } }
    }
    Now you have both the key and the text in the model. Your grid, and wherever else, can use genderText but you still have the number.

  6. #5
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Answers
    8
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default


    OK got it.. I've been using grid column renderer because of most samples by Sencha.
    I thought maybe there is a way to get rendered data without making any changes to model.

    Thanks my mate.
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

  7. #6
    Ext JS Premium Member
    Join Date
    Nov 2009
    Location
    St Louis,MO
    Posts
    267
    Answers
    20
    Vote Rating
    18
    James Goddard will become famous soon enough James Goddard will become famous soon enough

      1  

    Default


    No problem. Using a column renderer makes perfect sense if that is the only place you need the converted data. In your case since you need it elsewhere better to do it in the model.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar