⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

ajax sorting is not natural sorting



Ji Jia Jia
  • profile picture
  • Member

Posted 09 April 2013 - 15:01 PM

Hello,

 

I have a question, why my flexigrid ajax sorting is not sorting in natural sort?

Where can i modify it? 

 

 

 

JJ


davidoster
  • profile picture
  • Member

Posted 09 April 2013 - 22:45 PM

Can you give us an example what you mean?


Ji Jia Jia
  • profile picture
  • Member

Posted 10 April 2013 - 11:12 AM

Actually is like

http://13h.imghost.us/GF/ScreenShot002.jpg

But i would like to be

http://13h.imghost.us/pP/ScreenShot001.jpg

 

I think it's a matter of the natural sort, and i might tell that it's an relation field

 

 

$crud->display_as('tipo_q','Type')
        ->display_as('livello_q','Level')
        ->display_as('skin_q','Skin')
        ;

 

$crud->set_relation('livello_q','livelli','Level {livello_id} <span\nstyle="font-weight:bold;color:{livello_colore};">{livello_nome} {livello_num}</span>',null,'livello_id ASC');


davidoster
  • profile picture
  • Member

Posted 10 April 2013 - 22:00 PM

On strange cases, like this one, because set_relation might not be enough to display the data, at least my viewpoint is, to do a manual kind of set relation.

In other words via a model get the data in demand, then within controller alter the data array they way I need to and lastly use the field_type to pass the new data for the field.

 

Otherwise you need to define a sorting field, kind of weight and sort using this field.