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 make a specific peace of code visible when there is a match on a Route? react-router
Saga doesn't end when canceled
How to force update data cache in react-apollo?
How to make fixed-data-table React fixed columns to both left and right side?
Sharepoint:Thread was being aborted Exception web service
redux-form unable to type values in fields
React Router v3 per flow bundle splitting
progressive web app site cannot be installed: no icon available to display
react doesn't render components with changes even when state changes
Should form tags be used in React if I am just calling a function on submit?
Debugging “react-redux” application?
Diagnosing RangeError: Maximum call stack size exceeded in React KeyEscapeUtils
Update state by changing an entire object within state array
browserHistory not Moving to New Component in React
Reactjs modal height change
Can I bundle react.js apps into multiple modules?

Categories

HOME
primefaces
system-calls
mobile
postgresql-9.3
openacc
mysqli
weblogic
liquibase
dynamic
highmaps
spotfire
django-middleware
opc-ua
snmp
download
flowtype
procmon
country-codes
wavefront
samsung-gear-s2
guidewire
android-notifications
react-select
console-application
xforms
udeploy
xna
connection-pooling
poisson
scrapy-spider
scalatest
datanucleus
azure-table-storage
javapns
pushpad
opencsv
urhosharp
loopback
ports
eclipse-jdt
rtos
android-scrollview
aweber
android-databinding
linkurious
ninja-forms
autodesk-data-management
contenteditable
binary-decision-diagram
html-entities
android-doze-and-standby
automapper-4
spring-cloud-bus
django-tables2
px4
seyren
blackberry
zedgraph
rmq
acceleo
robotc
optional-parameters
scikit-image
strtol
jira-agile
rowname
falcon
boost-bind
laterjs
radar-chart
nugetgallery
ideavim
oryx
fadein
nonblocking
controlpanel
gitk
identifying
syncano
avrcp
cakephp-2.6
shunting-yard
static-files
random-access
jsonschema2pojo
dirname
atg-dynamo
banana-pi
hotlinking
traceur
elixir-framework
node-mongodb-native
db2-connect
maven-javadoc-plugin
svg-android
grunt-contrib-imagemin
misfire-instruction
qgraphicsscene
maven-webstart-plugin
nsautoreleasepool
cloudmade
generator-expression
string-length
nsregularexpression
netzke
jquery-1.8
jquery-ui-map
sqlbuddy
utm
clgeocoder
httppostedfilebase
peoplepicker
sipdroid
hwnd
xhtmlrenderer
javah
http-response-codes
rollover
software-update
urlscan

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