Filtering the options in SelectWidgets? That's something, I'd need, too... I guessed that the most generic way to do it would be to subclass sprox' SAORMProvider to accept arbitrary filter statementss. I haven't had the time to implement that already, but percious told me on IRC that it would be possible
Am Donnerstag, 10. Januar 2013 22:55:22 UTC+1 schrieb Craig Small: > > I'm hoping the list can "bridge the gap" between my controller and > widget. I have two problems: > A drop-down custom widget with options from a database field that > is filtered from sometinhg in the url > The widget "remembers" the last chosen option > > So I have a widget much like > > https://turbogears-dev.readthedocs.org/en/workshop/cookbook/sprox.html#creating-custom-dropdown-data > > and it has ALL of the options from my table. By given the access of > http://localhost:8080/thing/42 > my controller grabs the 42 so it knows item_id=42, so far so good. > My widget shows all genres, so far so good. > > But I want my widget to only show the options filtered by this item, so > the database access would have filter(model.Genre.other_key == 42) > appended to it. > > How do I get the item_id variable out of my controller into my widget? > > Second problem, I select a genre and hit submit, I want that widget to > have the default of the one I selected instead of blank which is what it > does now. Again the controller "sees" the selection but its a matter of > letting the widget know. > > - Craig > -- > Craig Small VK2XLZ http://enc.com.au/ csmall at : enc.com.au > Debian GNU/Linux http://www.debian.org/ csmall at : debian.org > GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5 > -- You received this message because you are subscribed to the Google Groups "TurboGears" group. To view this discussion on the web visit https://groups.google.com/d/msg/turbogears/-/upC_wAHL06gJ. 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.

