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

Nesting Redux Providers
How to pospone children evaluation in JSX
Clearing cache for log out in Relay.js app
Confirming Navigation with custom hash history does not work
undefined data from my action creator ? React/redux/thunk
Render a react element to a hidden area for measurement
Cannot read property 'panHandlers' of undefined
Webpack trying to hot reload react
react auto escapes my html tags
How could I convert a Mobx observable object into a string
can we reload the same component with different urls?
React Native alignSelf center and stretch to maxWidth?
combineReducers converts Immutable Map into plain JS object
undefined is not an object (evaluating 'this.props.replaceRoute(_Routes2.default.Home())')
“CSS module is undefined” error when using react-css-modules with react-router with locale and webpack
React App with Relay + Apollo client

Categories

HOME
msbuild
url
azure-documentdb
salesforce
gsm
apache-storm
blob
azure-database-mysql
redhawksdr
singleton
runtime
digital
console-application
hql
web-worker
bookmarklet
reportlab
google-street-view
aws-devicefarm
bug-reporting
angular2-pipe
functional-dependencies
ps
poisson
expressionengine
android-6.0-marshmallow
setup-project
uibarbuttonitem
cqlsh
drawrect
textview
contextmenustrip
webmock
zimbra
leaderboard
multi-user
linkurious
idea-plugin
flume-ng
definition
head
serialversionuid
appcmd
extjs3
try-catch-finally
ownership
firebase-job-dispatcher
optional-parameters
strtol
ldd
deck.js
falcon
android-xmlpullparser
bytearray
shtml
aws-kms
trendline
angular-promise
adempiere
identifying
bootstrap-tabs
glog
cl.exe
optimistic-locking
nsq
diffmerge
famous-engine
dotcmis
amzi-prolog
rda
jsmpp
imaplib
ekevent
xml-validation
xcode5.1
mencoder
proj4
nsautoreleasepool
msbuild-task
simplemembership
invalidoperationexception
flatten
fileoutputstream
qvariant
xhtmlrenderer
netbeans7.0
text-manipulation
dongle
linq-to-mysql
web-search
large-data-volumes
focus-stealing
bootstrap-protocol
moores-law
paperless

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App