0

根据flask appbuilder的文档,模型详细视图的显示顺序可以定义如下:

class DeviceView(ModelView):        
    datamodel = SQLAInterface(Device)
    related_views = [ApplicationView, EventView]

    label_columns = {'snr':'SNR', 'api_dev_id':'Device ID', 'api_dev_key':'Device Key','owner_id':'Owner'}
    list_columns = ['name','snr','addr','owner']

    show_fieldsets = [
        ('Summary',
            {'fields':['name','snr','owner']}
        ),
        ('Device Info',
            {'fields':    ['addr','latitude','longitude','status','api_id','api_key','api_dev_id','api_dev_key'],'expanded':True}
        ),
    ]

它适用于详细视图。但我找不到编辑视图的定义。这是我的设备编辑页面快照。顺序似乎是随机的。

我错过了文档中的任何部分吗?

在此处输入图像描述

4

1 回答 1

0

我从另一个问题中找到了答案:
Ordering data in a Flask Appbuilder view

class RegistrationTestView(ModelView ):
    datamodel = SQLAInterface(RegistrationTest)
    name = "RegistrationTestView"
    page_size=1000
    label_columns = {'CarNo':'Car #', 'FirstName':'First Name','LastName':'Last Name'}
    list_columns = ['CarNo','FirstName','LastName']
    edit_columns = ['FirstName','LastName']
    show_columns = edit_columns
    add_columns = edit_columns
    order_columns = ['FirstName']

编辑/列表/显示中的显示是单独排序的。

于 2017-11-16T00:23:59.673 回答