I see you have defined your fields as a Python set object:
myfields={db.articles.bulk_id,db.articles.dossier,db.articles.
date_sortie,db.articles.conteneur,db.articles.cod_ref}
Sets do not guarantee any particular order, and for non-integers, I think
the order can even change from process to process. Try a list or tuple and
see if the problem goes away.
Anthony
On Tuesday, November 13, 2018 at 4:58:51 AM UTC-5, Yann Dulondel wrote:
> Code of the grid
> def show_flexlist():
> type_article=request.args(0, cast=int)
> Results=db(db.type_article.id==type_article).select(db.type_article.
> articlename)
> row=Results[0]
> ArticleName=row['articlename']
> response.flash =T('Depot:')+str(auth.user.id_depot)
> request.title=T("Braid Logistics Europe")
> myquery=((db.articles.condi_id==type_article)&(db.articles.depot_id==
> auth.user.id_depot))
>
> #myfields={db.articles.cod_ref,db.articles.conteneur,db.articles.dossier,
> db.articles.id}
> #myheaders={'articles.cod_ref':T('Flexi
> Number'),'articles.conteneur':T('Conteneur
> Number'),'articles.dossier':T('Braid reference'),'articles.id':'ID'}
> myfields={db.articles.bulk_id,db.articles.dossier,db.articles.
> date_sortie,db.articles.conteneur,db.articles.cod_ref}
> myheaders={'articles.bulk_id':T('Bulkhead'),'articles.dossier':T('Braid
> reference'),'articles.date_sortie':T('Fitting Date'),'articles.conteneur':
> T('Conteneur Number'),'articles.cod_ref':T('Flexi Number')}
> default_sort_order=[db.articles.cod_ref]
> db.articles.cod_ref.writable=False
> db.articles.id_stk_article.writable=False
> db.articles.id_stk_article.visible=False
> links = [lambda row: A(T('View Flexi'),_href=URL(show_flexi,args=[row.
> id,type_article],user_signature=True))]
> flexlist=SQLFORM.grid(query=myquery
> ,orderby=default_sort_order
> ,deletable=False
> ,editable=False
> ,details=False
> ,maxtextlength=64
> ,paginate=25
> ,create=False
> ,fields=myfields
> ,headers=myheaders
> ,user_signature=True
> ,searchable=True
> ,args= [type_article]
> ,links=links)
>
>
> #,fields=fields,headers=headers
> return dict(message=ArticleName,flexlist=flexlist)
> Thank for the format='%(name)s %(id)s')I was believing that was the way
> to link the display name to the id record
> Once again thank, the web2py is great but the document is not detail
> enough.But i know that it's take time to provide documentation
> yann
>
> Le vendredi 9 novembre 2018 16:51:44 UTC+1, Yann Dulondel a écrit :
>>
>> Hi all
>> I have a strange behaviors from view model.
>> The columns are not in the same order when reloading page.See the bulk_id
>> column
>> I believe that i understood how columns order was setup: inverse order of
>> creation in contoller
>>
>> myfields={db.articles.bulk_id,db.articles.dossier,db.articles.date_sortie,db.articles.conteneur,db.articles.cod_ref
>> Corresponding colmns title= Bulk_id,Braid reference,Fitting date,numéro
>> de conteneur,numéro de flexi
>> First load
>> Reloading page
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.