Hi:  I am using the PaginateDataGrid with SQLObject.  It is working fine 
except for when I try to sort by a field in a table link by a foreign 
key.  Here are the details:

My Model (simplified, but complete for this example)
----------------------------------------------------
class Requisition(SQLObject):
    class sqlmeta:
        style = Style(longID=True)
        idName = 'requisitionId'
       
    plant = ForeignKey('Plant', dbName='plantId')
    requisitionPeriod = ForeignKey('RequisitionPeriod', 
dbName='requisitionPeriodId')
    itemNumber = UnicodeCol(length=15)
    itemName = UnicodeCol(length=50)
    requestedBy = ForeignKey('User', dbName='requestedById')
    dateRequested = DateCol()
    quantity = IntCol()
    uom = UnicodeCol(length=20)
    quantityReceived = IntCol()
    dateReceived = DateCol()
    dateCanHold = DateCol()
    dateNeeded = DateCol()
   
class Plant(SQLObject):
    class sqlmeta:
        style = Style(longID=True)
        idName = 'plantId'
       
    plantNumber = IntCol()
    name = UnicodeCol(length=50, alternateID=True)
  
    def __str__(self):
        return '%s' % (self.name)
----------------------------------------------------
The DataGrid definition:
----------------------------------------------------
requisitionList = PaginateDataGrid(fields=[
    PaginateDataGrid.Column('plant', 'plant', 'Plant', 
options=dict(sortable=True)),
    PaginateDataGrid.Column('itemName', 'itemName', 'Item', 
options=dict(sortable=True)),
    PaginateDataGrid.Column('quantity', 'quantity', 'Qty', 
options=dict(sortable=True)),
    PaginateDataGrid.Column('uom', 'uom', 'UOM', 
options=dict(sortable=True)),
    PaginateDataGrid.Column('dateOrdered', 'dateOrdered', 'Ordered', 
options=dict(sortable=True)),
    PaginateDataGrid.Column('dateNeeded', 'dateNeeded', 'Needed', 
options=dict(sortable=True)),
----------------------------------------------------
This is working fine except for when I try to sort by the Plant column.  
It seems like no matter what I put in the first parm of that column, I 
get the error:

StandardError: The order column (plant) doesn't exist

In the controller, my data set is:
----------------------------------------------------
requisitions = Requisition.select(orderBy='itemNumber')
----------------------------------------------------

What I want to be able to do is click on the Plant column header and 
have it sort by the plant 'Name'.  Is there a way to do this with the 
DataGrids, or am I just asking for too much?  Do I need to setup JOINs 
in my SQLObject select?  Any input would be appreciated.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to