Git Product home page Git Product logo

Comments (5)

gaearon avatar gaearon commented on May 7, 2024

Can you put up a minimal example so I can take a look?

from react-dnd.

onemanstartup avatar onemanstartup commented on May 7, 2024

I'm writing in coffee. This is ok? Or it is better make some online example?

Object.assign = Object.assign || require('object.assign')
FixedDataTable = require('fixed-data-table')
require('fixed-data-table/dist/fixed-data-table.css')
Table = FixedDataTable.Table
Column = FixedDataTable.Column
DragDropMixin = require('react-dnd').DragDropMixin
rows = [[1,2], [2,2], [2,2], [2,2], [2,2]]

rowGetter = (rowIndex) ->
  rows[rowIndex]

Row = React.createClass
  mixins: [DragDropMixin]
  configureDragDrop: (registerType) ->
    registerType('row', {
      dragSource: {
        beginDrag: ->
          {
            item: {
              id: this.props.id
            }
          }
      }
      dropTarget:
        over: (item) ->
          this.props.moveCard(item.id, this.props.id)
    })

  render: ->
    getDragState = @getDragState('row')
    isDragging = @getDragState.isDragging

    <div className='red' {...this.dragSourceFor('row')} {...this.dropTargetFor('row')}>
      hello
    </div>

module.exports = React.createClass
  displayName: 'Table'
  cellRender: (any_cellData, string_cellDataKey, object_rowData, number_rowIndex, any_columnData, number_width) ->
    <Row />
  render: ->
    <div>
      <Table rowHeight={40} rowGetter={rowGetter} rowsCount={rows.length} width={200} height={210} headerHeight={40} >
        <Column cellRenderer={@cellRender} label="lol" width={200} dataKey={0} />
      </Table>
    </div>

from react-dnd.

gaearon avatar gaearon commented on May 7, 2024

It would help to see this as a JSBin example (or a separate repo if you wish).

from react-dnd.

onemanstartup avatar onemanstartup commented on May 7, 2024

Actually, when I was trying to build jsbin example it works, then i check my dev and it works too, so strange. I will make jsbin if this problem arise again. Thanks.

from react-dnd.

gaearon avatar gaearon commented on May 7, 2024

No problem!

from react-dnd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.