Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ListView and Height

In my NativeScript App there is a ListView. In js add new items and height does not change. How change height ListView adjustment of children?

XML:

<ListView id="incomeList" items="{{ income }}" row="1" itemTap="">
    <ListView.itemTemplate>
        <StackLayout orientation="horizontal" cssClass="shares-item">
            <GridLayout columns="*, *, auto">
                <TextField text="{{ userId }}" cssClass="shares-item-label" col="0" keyboardType="number" />
                <TextField text="{{ cost }}" cssClass="shares-item-label" col="1" keyboardType="number"/>
                <Image ind="{{ ind }}" tap="removeIncomeElement" src="~/img/ic_close.png" col="2"/>
            </GridLayout>
        </StackLayout>
    </ListView.itemTemplate>
</ListView>

JS:

var incomeItems = new observableArray.ObservableArray();

function pageLoaded(args) {
    page = args.object;
    incomeList = view.getViewById(page, "incomeList");
}

function addIncome(args) {
    newItem = new observable.Observable({userId: 0, cost: 0, summ: 0, ind: incomeIndex});
    incomeItems.push(newItem);
    incomeList.items = incomeItems;
}
like image 555
IVsevolod Avatar asked Mar 25 '26 02:03

IVsevolod


1 Answers

You're using a ListView, so you need to give that Image tag a static height and width...

<Image ind="{{ ind }}" tap="removeIncomeElement" src="~/img/ic_close/png" col="2" width="75" height="75" />

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!