Comments (6)
Let's try v0.0.6! Documentation is not updated, so I want to put some notes here:
- use
new Datasource(...)
in your component to instantiate the datasource with the Adapter - use
{{datasource.adapter.firstVisible.$index}}
in your template to output first visible item's index wherefirstVisible
is dynamically updated item object - use
{{(datasource.adapter.firstVisible$ | async)?.$index}}
in your template to output first visible item's index wherefirstVisible$
is BehaviourSubject of first visible item object - use
this.datasource.adapter.firstVisible$.subscribe((value) => console.log(value.$index));
in your component's code to catch the exact moment when first visible item is changed - the subscription is smart enough, so you may subscribe even on your component's constructor before the uiScroll is initialized itself
The first visible item object has following properties
ItemAdapter {
$index?: number;
data?: any;
element?: HTMLElement;
}
This type is not exported out of the UiScroll module for now.
from ngx-ui-scroll.
I have updated to version 0.0.6 and the current index works fine! thanks
from ngx-ui-scroll.
@cristigav I drafter a solution in first-visible branch. Could you try it before next release?
git clone https://github.com/dhilt/ngx-ui-scroll.git
cd ngx-ui-scroll
git checkout first-visible
npm install
npm start
http://localhost:4200/#/test
The Adapter got new property firstVisible
that is an object of special type:
export interface ItemAdapter {
$index?: number;
data?: any;
element?: HTMLElement;
}
So to have current top index you should do something like this:
{{datasource.adapter.firstVisible.$index}}
from ngx-ui-scroll.
Thanks, works ok 👍
I will use it with the next release.
from ngx-ui-scroll.
Hi folks, I also need that new feature about the first visible. There is a date for the next release?
from ngx-ui-scroll.
Okay, I'm going to postpone major release and promise to publish v0.0.6 in 1-2 days
from ngx-ui-scroll.
Related Issues (20)
- What is the best practice to update an item within the list without flashing? HOT 2
- Smoothscrolling HOT 6
- Mouse wheel scrolling gets stuck on loading after updating Chrome (v102) HOT 2
- Item separation HOT 3
- Scroll position jumps/changes when new items are loaded in viewport HOT 2
- Data loading is abnormal when scrolling up HOT 6
- Nested cdkVirtualFor in cdk-virtual-scroll-viewport HOT 1
- Sluggish on iOS HOT 3
- Observable dataSource change (emission) does not update uiScroll list HOT 4
- remove\update\prepend does not work properly HOT 2
- Scrolling on item click when it's not fully visible in list HOT 2
- TypeError: Cannot read properties of undefined (reading 'log') HOT 5
- Angular 16 compatibility ? HOT 1
- Issue: adaptor.reload(reloadIndex) not functioning correctly on iOS HOT 11
- Object reference after appending HOT 2
- Is it possible to implement nested uiScroll? HOT 4
- Multiple scroll components with windowViewport HOT 6
- Custom Routines
- Pause/resume methods
- Viewport loads all items when positioned at top HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-ui-scroll.