Results 1 to 5 of 5

Thread: Grid view drag drop - view itemSelector undefined

  1. #1
    Sencha User
    Join Date
    Nov 2014
    Posts
    7

    Default Answered: Grid view drag drop - view itemSelector undefined

    I am using the MVC framework. I need to implement a grid with rows that can be reordered. The gridviewdragdrop plugin looks like it's simple enough to implement. However, right of the bat I am already encountering an error.

    When I click on a row (not even dragging), I get and error view.getItemSelector is not a function. It looks like when the row is clicked, onItemMouseDown is called which then calls getDragData. In debug mode, the value for view.itemSelector is "tr.x-grid-row". However, inside getDragData, view.itemSelector is undefined. I'm puzzled as to how it to lost in between the calls. Is there something obvious that I am missing?

    Unfortunately, I cannot post my full code here. But this is closed to what I have.

    Code:
    Ext.define('myproject.employees') {
      model: 'mypoject.employee',
      data: [
         {name: 'john', title: 'system engineer'},
         {name: 'jane', title: 'manager'}
      ]
    }
    
    Ext.define('myproject.employeeGrid') {
      requires: [
         'myproject.employees',
         'Ext.grid.plugin.DragDrop'
      ],
    
      plugins: [
        {
           ptype: 'gridviewdragdrop'
         }
      ], 
    
      store: 'myproject.employees',
      layout: 'fit'
    
      initComponent: function() {
        stateful: true,
        cls: 'custom-grid'
        columns: [
           {
              text: 'Name',
              dataIndex: 'name',
           },
           {
              text: 'Job Title',
              dataIndex: 'title',
           }
        ]
      }
    
      this.callParent();
    }

  2. Unlike most of the other grid-related plugins, the gridviewdragdrop plugin needs to be applied through the grid's viewConfig property, not through the grid's plugins property. I've provided this fiddle as an example.

    Thanks,
    Brian


  3. #2
    Sencha Premium User lumberjack's Avatar
    Join Date
    Nov 2014
    Location
    Kansas
    Posts
    781
    Answers
    102

    Lightbulb Try this

    Unlike most of the other grid-related plugins, the gridviewdragdrop plugin needs to be applied through the grid's viewConfig property, not through the grid's plugins property. I've provided this fiddle as an example.

    Thanks,
    Brian


  4. #3
    Sencha User
    Join Date
    Nov 2014
    Posts
    7

    Default

    Thanks Brian! This works!

    I was able to bypass the previous error. But when attempting to drag the row, the x-out icon remains and I am unable to drop the row. Any other "gotchas" that I should watch out for?

  5. #4
    Sencha Premium User lumberjack's Avatar
    Join Date
    Nov 2014
    Location
    Kansas
    Posts
    781
    Answers
    102

    Question

    Can you provide a screen shot of the x-out persisting? What does your updated code look like?

    Thanks,
    Brian

  6. #5
    Sencha User
    Join Date
    Nov 2014
    Posts
    7

    Default

    Brian, I figured out that it didn't work because I was including ext-all-debug.js (in trying to debug the previous problem). I ended up switching over to ext-all.js and now it works. Weird!

    Thanks for your help! I am new to the forum, so I don't know how it works but please mark this question as answered. Thanks!

Tags for this Thread

Posting Permissions

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