Re: [T5]: binding issue: supplying parameter to component --> always null
you were right on both remarks. I now tried "model=dataModel" but still model --> null. could it be (just guessing here) that grid.dataModel isn't initialized (and thus null) on the moment an action event goes off in the gridcolumns-class? anyway I looked further in the GridColumns-class and there's a field: @Parameter(value = "componentResources.container") private GridModelProvider _dataProvider; through this the original GridColumns-class is asking for the datamodel i wanted to get, for instance: public List getColumnNames() { return _dataProvider.getDataModel().getPropertyNames(); } however when i try to access the field in the same manner in my action-event handler I keep getting null: void onActionFromSort(String columnId) { for (String name : _dataProvider.getDataModel().getPropertyNames()) { //some code.. } } It must be the time of accessing this field in the component life-cycle that causes this problem I guess. Is this correct? And how to workaround this issue? Geert-Jan Josh Canfield-2 wrote: > > I'm not well versed in grid/gridcell... but one thing that jumps out is > that > you have "_model=_model" in your parameters. Shouldn't that be > "model=_model" ? Also, are you passing the model parameter in your > template? > Your Parameter isn't required so null may be the correct value. > > > I also haven't done inheritance like you are doing, but it looks like you > are redefining the _model attribute from the superclass? Should you maybe > be > using datamodel provided by the superclass instead? "model=datamodel"? > > http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/corelib/components/Grid.html > > I haven't written the code, but that seems to be what makes sense to me... > Josh > > > On 9/27/07, Britske <[EMAIL PROTECTED]> wrote: >> >> >> Hi all, >> >> I guess I'm missing something here, maybe a trival thing so bear with me >> please.;-) >> >> I'm trying to extend the T5 grid / griddatasource for my requirements. >> For >> some event-handling in GridColumn I need to reference the field _model of >> type BeanModel which exists in the Grid-class from GridColumn. So I both >> extended Grid --> LazyConfigurableGrid and GridColumns --> >> LazyGridColumns. >> >> next,I supplied field _model as a parameter from the gridclass to the >> gridcolum-class. >> >> My problem: >> _model==null in GridColumn all the time. I guess this is some >> binding-thing >> that I can't quite get my head around. (_model == null on initialization >> of >> the component, but i thought it would be updated later on) >> >> The general question: how to pass objects by reference as parameters, >> since >> they always seem to be null. >> >> the relevant bits: >> >> LazyConfigurableGrid: >> >> @Parameter >> private BeanModel _model; >> >> @SuppressWarnings("unused") >> @Component(parameters = >> { "sortColumnId=sortColumnId", "sortAscending=sortAscending", >> "source=_source", "_model=_model" }) >> private LazyGridColumns _columns; >> >> >> LazyGridColumns: >> >> @Parameter >> private BeanModel _model; >> >> Thanks in advance, >> Geert-Jan >> >> >> -- >> View this message in context: >> http://www.nabble.com/-T5-%3A-binding-issue%3A--supplying-parameter-to-component---%3E-always-null-tf4530634.html#a12928987 >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > > -- > -- > TheDailyTube.com. Sign up and get the best new videos on the internet > delivered fresh to your inbox. > > -- View this message in context: http://www.nabble.com/-T5-%3A-binding-issue%3A--supplying-parameter-to-component---%3E-always-null-tf4530634.html#a12936000 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [T5]: binding issue: supplying parameter to component --> always null
I'm not well versed in grid/gridcell... but one thing that jumps out is that you have "_model=_model" in your parameters. Shouldn't that be "model=_model" ? Also, are you passing the model parameter in your template? Your Parameter isn't required so null may be the correct value. I also haven't done inheritance like you are doing, but it looks like you are redefining the _model attribute from the superclass? Should you maybe be using datamodel provided by the superclass instead? "model=datamodel"? http://tapestry.apache.org/tapestry5/tapestry-core/apidocs/org/apache/tapestry/corelib/components/Grid.html I haven't written the code, but that seems to be what makes sense to me... Josh On 9/27/07, Britske <[EMAIL PROTECTED]> wrote: > > > Hi all, > > I guess I'm missing something here, maybe a trival thing so bear with me > please.;-) > > I'm trying to extend the T5 grid / griddatasource for my requirements. For > some event-handling in GridColumn I need to reference the field _model of > type BeanModel which exists in the Grid-class from GridColumn. So I both > extended Grid --> LazyConfigurableGrid and GridColumns --> > LazyGridColumns. > > next,I supplied field _model as a parameter from the gridclass to the > gridcolum-class. > > My problem: > _model==null in GridColumn all the time. I guess this is some > binding-thing > that I can't quite get my head around. (_model == null on initialization > of > the component, but i thought it would be updated later on) > > The general question: how to pass objects by reference as parameters, > since > they always seem to be null. > > the relevant bits: > > LazyConfigurableGrid: > > @Parameter > private BeanModel _model; > > @SuppressWarnings("unused") > @Component(parameters = > { "sortColumnId=sortColumnId", "sortAscending=sortAscending", > "source=_source", "_model=_model" }) > private LazyGridColumns _columns; > > > LazyGridColumns: > > @Parameter > private BeanModel _model; > > Thanks in advance, > Geert-Jan > > > -- > View this message in context: > http://www.nabble.com/-T5-%3A-binding-issue%3A--supplying-parameter-to-component---%3E-always-null-tf4530634.html#a12928987 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.
[T5]: binding issue: supplying parameter to component --> always null
Hi all, I guess I'm missing something here, maybe a trival thing so bear with me please.;-) I'm trying to extend the T5 grid / griddatasource for my requirements. For some event-handling in GridColumn I need to reference the field _model of type BeanModel which exists in the Grid-class from GridColumn. So I both extended Grid --> LazyConfigurableGrid and GridColumns --> LazyGridColumns. next,I supplied field _model as a parameter from the gridclass to the gridcolum-class. My problem: _model==null in GridColumn all the time. I guess this is some binding-thing that I can't quite get my head around. (_model == null on initialization of the component, but i thought it would be updated later on) The general question: how to pass objects by reference as parameters, since they always seem to be null. the relevant bits: LazyConfigurableGrid: @Parameter private BeanModel _model; @SuppressWarnings("unused") @Component(parameters = { "sortColumnId=sortColumnId", "sortAscending=sortAscending", "source=_source", "_model=_model" }) private LazyGridColumns _columns; LazyGridColumns: @Parameter private BeanModel _model; Thanks in advance, Geert-Jan -- View this message in context: http://www.nabble.com/-T5-%3A-binding-issue%3A--supplying-parameter-to-component---%3E-always-null-tf4530634.html#a12928987 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]