selection


programmatically change selected rows in a slickgrid


Using slickgrid, I need to select/deselect rows on the fly, and here is my code, it seems to work but sounds a bit suboptimal really, is there any smater means to do this ?
// turn records checkbox on or off depending on 'checked'
function set_checkbox (record, checked) {
var id = record[primary_key];
var index = dataview.getIdxById(id);
var selectedRows=this.slick_grid.getSelectedRows();
if (checked) // add index in current list
selectedRows=selectedRows.concat(index);
else // remove index from current list
selectedRows=selectedRows.filter(function(idx) {return idx!=index;});
this.slick_grid.setSelectedRows(selectedRows);
}
The grid is initialized with this selection model here:
grid.setSelectionModel (new Slick.RowSelectionModel ({selectActiveRow: false}));
This is quite simple using the grid helper method setSelectedRows(rowsArray)
The full description is here:
https://github.com/mleibman/SlickGrid/wiki/Handling-selection
Previous answer is correct if the rows are visible. However, programmatic selection typically means you have a different view of the same data and if the row containing selected item is hidden (due to filtering, group being collapsed, etc) then you really need to dig deeper and patch slickgrid to be able to select rows by Id. Hope this helps.

Related Links

Retrieving Selection Data from Applications other than xterm
How to activate selected text replacement when typing new text?
GIMP: Subtract overlapping selections
Opencart: Add extra features under the same product
AQGridView Selection and Deselection
make 2 different selection-tools coexist in pyside
Swapping text selections in Sublime Text 2
Selecting text with Sublime Text 2
Stata: Lag length criteria: How can I explain the results?
jquery-autocomplete default selection
Zend Studio selecting full Block
Genetic Algorithm - producing a new generation
UICollectionView shouldSelectItemAtIndexPath=NO does not avoid deselecting old selection?
UICollectionView Tap Selects More Than One Cell
Should this be selection or projection
Deselecting cells programmatically in NSMatrix does not work

Categories

HOME
oracle
weblogic12c
verification
openxml
scroll
activex
activemq
code-formatting
odata
qooxdoo
vue-resource
azure-data-lake
video-streaming
tweepy
sympy
jpa-criteria
sharepoint-online
match
documentum
buffer
sslhandshakeexception
jpa-2.0
corona
orange-api
infrared
bluemix-mobile-services
opam
error-logging
yii2-basic-app
dashdb
web-analytics
el
unrar
multi-dimensional-scaling
hevc
pyspark-sql
nic
tightvnc
gnu-classpath
db2-luw
amazon-kms
identify
telephonymanager
rdp
microkernel
stat
hypothesis-test
elasticsearch-aggregation
virtual-memory
common-table-expression
.net-micro-framework
sigsegv
subforms
scala-collections
palindrome
stateless-session-bean
mechanicalturk
prefetch
logical
system.web.optimization
servicestack-bsd
perceptron
html.actionlink
decidable
self
http.client
gluon-desktop
search-form
sequence-sql
angular-amd
sablecc
python-c-extension
maven-shade-plugin
mod-auth-openidc
juttle
relationships
lmax
nidaqmx
nodeload
cidr
django-sites
sensormanager
eclim
vlab
sly-scroller
ntlmv2
user-forums
cgrectmake
getopt-long
jdom
uploading
kolite
expression-web
will-paginate
server-variables
mongrel2
aggregator
zend-test
gtktextview
stretchblt

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