Results 1 to 4 of 4

Thread: How to select a node in a Dataview

  1. #1
    Sencha User
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    15

    Default How to select a node in a Dataview

    I'm trying to programmaticly select an item in a DV. I see the dataview.select() method in the API, but after passing it a css selector, number, etc... it doesn't seem to fire the selectionChanged or any other event of the Dataview.

    I'm trying to select a particular row in the table that my Dataview is rendering. I've also tried an Ext.get() for the id of the row after the DV is rendered, but that doesn't seem to work either.

    Anyone have any ideas?!

    Ultimately I want to highlight the row that was just added to the table. Also tried creating a record and adding that to the store to update the DV, but the store.add() always throws an error when adding a record.

    Thanks allot...

  2. #2

    Default

    I do like this (currentFileId is the id of selected node):
    Code:
    			var el = Ext.get('cms-img-chooser-img-'+this.currentFileId)
    			this.view.select(el)
    my data view template like this:
    Code:
    		this.thumbTemplate = new Ext.XTemplate(
    				'<tpl for=".">',
    				'<div class="thumb-wrap" id="cms-img-chooser-img-{id}">',
    				'<div class="thumb"><img src="{thumbnail_url}" title="{title}"></div>',
    				'<span>{shortName}</span></div>',
    				'</tpl>',
    				'<div class="x-clear"></div>');

  3. #3
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    myDataView.select(0) works perfectly for me. Selects node zero, fires the events, and everything kicks off to display details.

  4. #4
    Sencha Premium User NoahK17's Avatar
    Join Date
    Apr 2008
    Location
    Atlanta, GA
    Posts
    538

    Default

    Just to confirm, this still works in ExtJS 6.5.3

    myDataView.select(index)
    Noah
    Front-End Developer
    Norfolk Southern

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •