Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #278 (closed enhancement: fixed)

Opened 14 years ago

Last modified 12 years ago

[PATCH] Add DataGrid/DataController fields reordering/selection capabilities to the view and Controller

Reported by: Luca <luca@…> Owned by: anonymous
Priority: normal Milestone: 0.9
Component: TG Widgets Version:
Severity: normal Keywords: form widget fastdata datacontroller order select datagrid patch


This patch completes the patch in #259, adding the missing features to sort/select the fields shown in the DataController listing.

With this patch you can do:

class Person(SQLObject):
    name = StringCol(length=255)
    age = IntCol()
    tel = StringCol(length=20)
    birth = DateCol()

class SomeController:
    person = DataController(Person,
        form_fields=['name', 'age', 'tel'],
        list_fields=['name', 'birth'])

And you will see name, age and tel fields in the forms (add/edit) and just name and birth in the listing.

If you don't specify list_fields, form_fields will be used, and even if you specify list_fields you can override that in the view using the fields parameter to insert():

${list_widget.insert(data, fields=['name', 'birth'])}

This patch also uses the title in the model columns if present. The idea was to use title in the forms too, but I couldn't because of #277 (which I don't really know how to fix due to my lack of experience and knowledge in KID and maybe TG internals too).


turbogears-r383-grid-datacontroller-fields-selection.patch Download (3.8 KB) - added by Luca <luca@…> 14 years ago.

Change History

Changed 14 years ago by Luca <luca@…>

comment:1 Changed 14 years ago by kevin

  • Status changed from new to closed
  • Resolution set to fixed

committed in [388]. Thanks!

Note: See TracTickets for help on using tickets.