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

React-Router multiple RouteHandlers on same component
intercept ReactJS synthetic keydown handler
Browserify fails to create bundle with babelify transform (TypeError: Path must be a string.)
Accessing React component's static methods inside propTypes is not allowed
Flux/utils: How to access to props in the calculateState method?
What is the correct way to implement a stateless authentication?
Only animate list items when new are inserted, not when mounting initial
React as webpack external dependency
Karma + Browserify + Jasmine + Istanbul + React coverage
react boilerplate / generator with gulp, browserify, babel, etc?
Optimizing React Rendering with Function Partial Application
How to pass store explicitly into as a prop to “Connect()”
How can I use HTML5 Validation with React?
react testing: shallow rendering - getRenderOutput returning null
Async loaded config data for reactjs
Why is my context.router undefined in my react component?

Categories

HOME
drupal
gulp
twitter-bootstrap
redux
mobile
sip
pyspark
cors
bigtable
readdir
highmaps
livecharts
django-middleware
crm
x509certificate
itext7
arguments
query-string
artifactory
google-docs-api
servicenow
zabbix
genexus
sahi
facebook-sharer
elastalert
http-status-codes
drush
oxid
swift3.1
lambda-calculus
reportlab
datazen-server
polybase
android-navigation-drawer
fibonacci
pumping-lemma
ecmascript-2017
traveling-salesman
xlib
key-bindings
machine-code
certbot
cocoa-scripting
android-databinding
multi-user
strategy-pattern
pygraphviz
var
keychain
contenteditable
nshttpurlresponse
ocamlbuild
react.rb
trusted-computing
wicketstuff
timex
directinput
racket-student-languages
dimensionality-reduction
boost-range
disconnect
instaparse
normalisation
sprockets
bytearray
pebble-js
skbio
wordpress-plugin
jersey-test-framework
overlapping
imageicon
self-join
pagecontrol
esb-toolkit-2.1
nfa
alpha-beta-pruning
xcode5
uiblureffect
apache-pivot
vundle
dirname
pyalgotrade
class-library
nomachine
maven-javadoc-plugin
mobile-robots
source-depot
leap-year
dnsbl
invalidoperationexception
jquery-1.8
reflexil
parsec
motorola-droid
helicontech
utm
vectorwise
lwp
javah
dojox.gfx
coderush-xpress
time-management
manuals
scala-designer
jettison

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