reactjs


How to get DataSource length in react-native?


How do I get the DataSource's length of a ListView?
Suppose I have the following declaration:
const ds = new ListView.DataSource({ rowHasChanged });
...
someObjectsDs = ds.cloneWithRows(someObjectsArray);
I've tried someObjects.length but this returns me undefined.
You can view the amount of rows to be rendered by calling
someObjectsDs.getRowCount()
Official documentation
You can either dig into the datasource object to find the data and grab the length or you can set the data as a property of the component and refer to that:
this.someObjectsArray = someObjectsArray;
someObjectsDs = ds.cloneWithRows(this.someObjectsArray);
Now you will be able to do this.someObjectsArray.length, just make sure you're updating this variable anytime you're updating the datasource.

Related Links

How to get data from State?
Default value in react-ranger with redux form
Using a closure to encapsulate state for React components
Adding boolean values in JSX
How to add error information empty field and redirect after login in ReactJS and Firebase?
Invariant Violation: getNodeFromInstance: Invalid argument
The last route fetches all the chunks with code split with webpack 2 and react-router v3:
Webpack, babel and React Error message
- AJAX DataTables - Adding a condition in 'columns' (render) which returns a button (Link) of React-Router is not working - ReactJS -
How to correctly wrap Google Closure UI Component as Rum Component
DefinitelyTyped: Add new props typing for existing component
how to bind reactjs form submission action to spring controller
function return true after setTimeout (shouldComponentUpdate)
Children with the same key: Object.assign vs _.merge
Reactjs Router version4 Routing issue
Make the admin dashboard in the right way

Categories

HOME
asterisk
spring-boot
ssms
botframework
wifi
google-docs-api
checkpoint
symfony-3.2
rmarkdown
dcos
minimax
expo
jinja2
brightway
accordion
scotty
typedef
screen-scraping
quality-center
aws-certificate-manager
smart-device
tftp
akamai
exacttarget
spring-oauth2
qt-designer
unity3d-5
availability
http-proxy
intersection
maven-2
instances
sknode
susy
vertical-alignment
file-descriptor
binary-decision-diagram
gridgain
amazon-fire-tv
synchronized
qtwebkit
spring-ide
spring-cloud-bus
serialversionuid
node-java
fileopendialog
innertext
fadein
gnu-sort
jts
taverna
persian
jain-sip
adempiere
consul-template
sparkcore
genero
mri
indices
fedena
conditional-comments
im4java
time-frequency
webshim
lettuce
elixir-framework
codio
xcode6.1-gm-seed
aspnet-compiler
ojb
record-locking
forward-declaration
cloudmade
nx
moonscript
shapado
beep
project-files
umfpack
openwrap
zipstream
carbon-emacs
manuals
j++
hotfix
paperless

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App