Set height of GridLayout row in typescript


#1

Is there a way to set the height of a GridLayout row in typescript? I have a legend in a row and I want it to show/hide when a form is submitted. I’ve tried:

let legend = <GridLayout>this.legend.nativeElement;
        let rowArray = legend.getRows();
rowArray[1] = new ItemSpec(40, GridUnitType.PIXEL);

It doesn’t work.

Neither does rowArray[1].height = 40

It appears when I getRows() I don’t get an array, but an Observable.


#2

Yes, it’s an Observable as mentioned in class definitions / docs.


#3

That’s not what I see:

getRows(): Array<ItemSpec>


#4

Sorry, it was my bad I didn’t look at it carefully.

After checking docs and code, I think you can only set the rows / columns or add new row / column but you can’t update value of particular row / column spec.


#5

I’m not sure the api docs are right. I was getting an Observable back when I tried getRows(). However, I’m not sure how to get or set the values on the height once I had them as an Observable. I wish the api had examples. Nativescript docs are getting better, but it would be nice if they were clearer.