Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    4
    Vote Rating
    0
    marcenana is on a distinguished road

      0  

    Default Column with data rendered to sort

    Column with data rendered to sort


    Hello,
    I have a Grid with a store (and a PagingToolbar) .
    One of the store's columns is rendered manually.
    When I do a sort of this column, it's sort it by the original data order and not by what I remplace it (it's normal behaviour).
    But I want to sort it. I look in your forum I found the CONVERT attribute:

    Code:
     var MyStore = new Ext.data.JsonStore( {
                autoLoad :false,
                remoteSort: true,
                fields : [
                   {name: 'idArticle',  mapping: 'idArticle'},
                   {name: 'qte',  mapping: 'qte'},
                   {name: 'qte2',  mapping: 'qte2'},
                    {name: 'colonneAnomalie', mapping:   0, 
                        convert: function(value, data) { 
                              if(data['qte']<data['qte2'])
                            {
                             return("Manquants"); 
                            }    
                            if(data['qte']>data['qte2'])
                            {
                             return("En trop"); 
                            } 
    }
    The problem is that my store must be loaded remotlely because my pagination... So, it looks in database the column and I have the message 'colonneAnomalie' does not exist...
    Can I sort only this column by an other way? With pagination I think I must do it in Java? Maybe the best it's to add a column to my database and insert my string in it? but I want to be sure I cannot do something simply in extjs...

    thanks

  2. #2
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Quote Originally Posted by marcenana View Post
    So, it looks in database the column and I have the message 'colonneAnomalie' does not exist...
    I'm confused by what you mean here?

    The convert function is the correct way to go - and the fact you load the store remotely makes no difference with this. The field also doesn't have to already exist, or be returned from your DB - this can be created on the fly depending on other record values, etc.

  3. #3
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Here's a quick example:
    http://jsfiddle.net/Whinters/Qbaa5/

  4. #4
    Sencha User
    Join Date
    Jul 2012
    Posts
    4
    Vote Rating
    0
    marcenana is on a distinguished road

      0  

    Default


    Thank you for you quick reply.
    But it's doesn't seem to work in my case because pagination. Your example is with a local array.
    It "workz" if I put off the remoteSort: true, but when it makes the sorting, it does it only in the current page, so when I go to next page, I have again values that began by "E" again.
    If I leave the remortSort, it will charge my values again from database, using my sorted column name whitch not exists...
    This is what is posted (firebug)
    Code:
    dir ASC
    idSupport 490921
    limit 50
    sort colonneAnomalie
    start 0
    Do you have an other idea?
    Thanks,

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Posts
    544
    Vote Rating
    51
    willigogs is a jewel in the rough willigogs is a jewel in the rough willigogs is a jewel in the rough

      0  

    Default


    Since it's not a field that exists in your DB, then you will have to handle this logic server side and return the recordset based on this "colonneAnomalie" field - or as you said previously, add this column to your DB table...

  6. #6
    Sencha User
    Join Date
    Jul 2012
    Posts
    4
    Vote Rating
    0
    marcenana is on a distinguished road

      0  

    Default


    I have change my sql request:


    Code:
    SELECT ....
    (case  WHEN CRD_QTE_SCANNE>CRD_QTE_ATTENDUE THEN 'En trop' 
     WHEN  CRD_QTE_SCANNE<CRD_QTE_ATTENDUE then  'Manquants' 
     end) as anomalie
    ...
    and I put simply in my store

    Code:
    {name: 'anomalie', mapping:  'anomalie'}
    It's working perfectly now....
    Thank you for your help.

Thread Participants: 1

Tags for this Thread