Results 1 to 3 of 3

Thread: Help needed on DataView with mouseenter

  1. #1
    Sencha User
    Join Date
    Dec 2010
    Posts
    7

    Default Help needed on DataView with mouseenter

    Hi. I have a Dataview with it's source data attached as "data: [an array variable]". It display's perfectly, but now I have to make a map snap to an items position. I have the mouseenter mechanism working, but have two problems.

    1 - The Index passed in the event is always -1
    No matter what I try, the event variable that is supposed to have the selected items index, always contains -1

    2 - Access to the underlying 'data' in the DataView to get the XY coords
    Even if I could get the index, I have no idea how to get to the variables in the original Array/Object to retrieve the items XY coordinates

  2. #2
    Sencha User Screamy's Avatar
    Join Date
    Jun 2008
    Posts
    244

    Default

    Did you configure the 'mouseenter' event handler in-line, something like?

    Code:
    var dv = new Ext.DataView({
      emptyText: 'No data',
      itemSelector:'div.someElement',
      listeners: {
        mouseenter: function(dataview, index, node, eventObject) {
           // do something ehre.
        }
      },
      multiSelect: true,
      store: someStore,
      tpl: someTpl
    })

  3. #3
    Sencha User
    Join Date
    Dec 2010
    Posts
    7

    Wink [SORTED]

    Basically, the datasource was an Array attached to 'data' in config, with no 'store' defined. Finally figured that a store is essential in looking up the source data, so used some info from here to build an ArrayStore from my array.

    My source data varied in field definitions but fortunately the data object had an array describing the fields, so I looped through these constructing an array of Record Field definitions to apply to the array store, then I looped through the results in the data object and added them to a simple array, as well as adding extra properties to each array object. Finally bound those 2 up in an ArrayStore, and attached it to my DataView.

    Just a note to anyone else having problems with stores - use JSLint (website) to check your code syntax ("Clear all options" for basic checking). My biggest breakthrough was finding a syntax error that was stopping it all from ever working.

    Thanks all who looked and thought about it!

Similar Threads

  1. dataview drag / drop ordering help needed
    By jake2891 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 29 Nov 2010, 2:45 PM
  2. Dataview does not fire 'mouseenter' event
    By Muhlegg in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 17 Aug 2010, 10:12 PM
  3. [FIXED][3.0] mouseenter
    By INeedADip in forum Ext 2.x: Bugs
    Replies: 5
    Last Post: 21 Apr 2009, 6:46 AM
  4. DataView help needed
    By dddu88 in forum Ext 2.x: Help & Discussion
    Replies: 7
    Last Post: 3 Nov 2008, 9:00 AM

Posting Permissions

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