Hi there, I'm trying out some of the data grid features such as infinite scrolling. So I've created a sample in which the first load works fine, it loads the first 20 items correctly. But is there anyway to have an event that triggers once the scroll reaches the bottom?
I could use the actionBegin event based on this documentation: https://ej2.syncfusion.com/vue/documentation/api/grid/#actionbegin. But it only triggers if I have more than 20 items initially. What I'm trying to achieve is to load the items on demand every time the scroll reaches the bottom. Can please anyone help me?
Sample link: https://drive.google.com/file/d/1f99S50FwPwSYNzTrPPoOz99nuxAb0Txj/view?usp=sharing
The sample I've made is under views > SyncFusion-Grid-Ajax.vue
|
<script>
export default {
name: "App",
data() {
return {
data: {},
. . .
}
},
methods:{
dataStateChange: function (state) {
var self = this;
var param = {
includes: ['discount', 'selected_variant', 'size'],
page: (state.skip + 1),
pageSize: state.take,
sort: 'title'
};
return $.ajax({
type: "POST",
data: param
}).done(function(r){
. . .
// we consider r.size may be the total records count
self.data = {result:r.Data, count: r.size };
});
},
}
}
</script>
|
Hi Pavithra,
Thank you so much for the help. It works fine now. Also I'm trying the Cache Mode for Infinite scrolling, but I can't see the difference when I enable or disable it. The data becomes empty after I redirect to another page, e.g. open /sf-grid-ajax (data is loaded here), then open /others, then go back to /sf-grid-ajax (data grid is empty and need to hit the ajax again)
Can I know what is expected when the cache mode is enabled?
=======
One more thing, I'm also trying the VirtualScroll feature, I tried adding :enableVirtualization=true and import the VirtualScroll as well as adding it in the provide section. It shows error on my end once the scroll reaches the end. I've updated the sample for you to look at if you don't mind.
Sample link: https://drive.google.com/file/d/16SoXdhS5IwKlaok1podmhxSDBgwOkFAC/view?usp=sharing
Regards,
Erwin
Hi Pavithra,
Thank you for the explanation. I think that's all for now. Have a great day!
Regards,
Erwin