PDA

View Full Version : [CLOSED] RowExpander Renderer and store bind on this.record



registrator
May 19, 2015, 9:25 PM
.Plugins(
X.RowExpander()
.Renderer("if (record.Splits.lenght === 0) { return false; }")
.SingleExpand(false)
.Component(X.GridPanel()
.HideHeaders(true)
.Store(X.Store().ModelName("UsageDataModelList"))
.ColumnModel(
X.Column().Text("").Width(82),
X.DateColumn().Text("Date").DataIndex("DATE").Width(90),
X.Column().Text("Ref").DataIndex("REFERENCE").Width(60),
X.Column().Text("").Width(120),
X.Column().Text("Details").DataIndex("DETAILS").Width(240)
)
.Listeners(l =>
{
l.ViewReady.Handler = "this.bindStore(record.usages);";
l.ViewReady.Delay = 1;
})
)

)

This is my Row Expander but it doesn't work well. The selected record has a Splits property which is a List<Class>
This list should be presented in the expanding grid.
How can I get the actual Splits property from the record please?

THank you

Daniil
May 19, 2015, 9:55 PM
Hi @registrator,

This example might help you to start with.
http://examples2.ext.net/#/Associations/HasMany/Simple

Well, if you have not already seen that.

registrator
May 20, 2015, 10:58 AM
Yes, this is the sample I was following and there you have


this.bindStore(this.record.products());

When I do this in my code


this.bindStore(this.record.splits());

I get a message that splits() in not a function.

I am not sure how to get my splits list and what does the products() actually refers to because even in the sample the products() as function does not exist.

Thank you

Vladimir
May 25, 2015, 8:44 AM
Hi



I get a message that splits() in not a function.


Did you define associations in the store like in online example?
Please define simple test sample which demonstrates the issue and we will help you

registrator
May 25, 2015, 2:42 PM
This is the association defined:


.Associations(a => a.Add(X.HasManyAssociation()
.Model("SplitDataModelList")
.Name("Splits")
.AssociationKey("Splits")
))

what is the Splits() function above? Name or Association Key?
There is not explanation with the example so I was guessing what relates to what

Daniil
May 26, 2015, 4:26 PM
These links should be helpful.
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.association.Association-cfg-associationKey
http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.data.association.HasMany-cfg-name

According to the description it is a HasManyAssociation's Name.

Please note that it is case sensitive.