【问题标题】:Get/Set loadOnDemandBufferSize or loadMoreDataRequested through JavaScript通过 JavaScript 获取/设置 loadOnDemandBufferSize 或 loadMoreDataRequested
【发布时间】:2019-05-27 20:58:46
【问题描述】:

我在 RadListView 上使用 loadOnDemandBufferSize="10" 有一个 SearchBar,当我提交搜索时,会触发 loadMoreDataRequested 属性,将其他项目推送到搜索结果中。

searchBar 使用不同的方法来检索数据。我可以更新 onLoadMore 方法使用的 http.getJSON URL,但我相信暂时禁用 RadListView 中的 loadOnDemandMode 会更好。

我只需要在提交搜索时暂时禁用 loadMoreDataRequested 或将 loadOnDemandBufferSize 设置为零,以便单独保留搜索结果。

有没有办法使用 JavaScript 获取/设置 loadMoreDataRequested 或 loadOnDemandBufferSize?我的项目在 Nativescript-Vue 上运行。

mounted() {
      console.log(this.$refs.listView.nativeView.loadMoreDataRequested)
      console.log(this.$refs.listView.loadMoreDataRequested)
      console.log(this.$refs.listView.nativeView)
      console.log(this.$refs.listView)
}
<GridLayout columns="*" rows="auto, *, auto">
    <SearchBar @submit="searchHttp" v-model="search" v-show="searchShow" height="50" row="0" />
    <RadListView
      for="item in items"
      loadOnDemandMode="Auto"
      loadOnDemandBufferSize="10"
      @loadMoreDataRequested="onLoadMore"
      @itemTap="onItemTap"
      ref="listView"
      row="1"
    >
      <v-template>
        <StackLayout :class="$odd ? 'list-group-item list-group-item-odd' : 'list-group-item'" orientation="vertical">
          <Label :text="item.created + ' - ' + item.company_id" />
        </StackLayout>
      </v-template>
    </RadListView>
    <Label v-if="items != null && !activity" :text="'Total ' + items.length" class="search-total" height="30" row="2" />
    <ActivityIndicator :busy="activity" borderRadius="50" color="#6c6aa6" width="50" height="50" rowSpan="3" />
</GridLayout>

【问题讨论】:

    标签: vue.js nativescript nativescript-vue


    【解决方案1】:

    您可以将loadOnDemandMode 属性设置为None

    import * as RadListViewModule from "nativescript-ui-listview";    
    
    this.$refs.listView.nativeView.loadOnDemandMode = RadListViewModule.ListViewLoadOnDemandMode.None;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-07-21
      • 1970-01-01
      • 2010-12-18
      相关资源
      最近更新 更多