【问题标题】:Trello Drag And Drop Cards Using Scrolling Containers whith PHP MYSQL AJAX使用带有 PHP MYSQL AJAX 的滚动容器的 Trello 拖放卡片
【发布时间】:2020-04-10 16:44:50
【问题描述】:

我需要创建一个类似 Trello 的框架,其中包含 4 个列表和卡片,我想在这些列表之间拖放卡片,但是,我想知道如何在拖放时更新 Mysql 中的数据库要素? 我无法确定如何更新 ajax 和 php。

script.js

var itemContainers = [].slice.call(document.querySelectorAll('.board-column-content'));
var columnGrids = [];
var boardGrid;

// Define the column grids so we can drag those
// items around.
itemContainers.forEach(function (container) {

  // Instantiate column grid.
  var grid = new Muuri(container, {
    items: '.board-item',
    layoutDuration: 400,
    layoutEasing: 'ease',
    dragEnabled: true,
    dragSort: function () {
      return columnGrids;
    },
    dragSortInterval: 0,
    dragContainer: document.body,
    dragReleaseDuration: 400,
    dragReleaseEasing: 'ease'
  })
  .on('dragStart', function (item) {
    // Let's set fixed widht/height to the dragged item
    // so that it does not stretch unwillingly when
    // it's appended to the document body for the
    // duration of the drag.
    item.getElement().style.width = item.getWidth() + 'px';
    item.getElement().style.height = item.getHeight() + 'px';
  })
  .on('dragReleaseEnd', function (item) {
    // Let's remove the fixed width/height from the
    // dragged item now that it is back in a grid
    // column and can freely adjust to it's
    // surroundings.
    item.getElement().style.width = '';
    item.getElement().style.height = '';
    // Just in case, let's refresh the dimensions of all items
    // in case dragging the item caused some other items to
    // be different size.
    columnGrids.forEach(function (grid) {
      grid.refreshItems();
    });
  })
  .on('layoutStart', function () {
    // Let's keep the board grid up to date with the
    // dimensions changes of column grids.
    boardGrid.refreshItems().layout();
  });

  // Add the column grid reference to the column grids
  // array, so we can access it later on.
  columnGrids.push(grid);

});

// Instantiate the board grid so we can drag those
// columns around.
boardGrid = new Muuri('.board', {
  layoutDuration: 400,
  layoutEasing: 'ease',
  dragEnabled: true,
  dragSortInterval: 0,
  dragStartPredicate: {
    handle: '.board-column-header'
  },
  dragReleaseDuration: 400,
  dragReleaseEasing: 'ease'
});

【问题讨论】:

  • 究竟在哪里卡住了?到目前为止,您尝试过什么?

标签: javascript php jquery mysql ajax


【解决方案1】:

我想建议你使用这个 jKanban 板 在此您可以很容易地找到所有事件,如果您遇到任何问题,请告诉我

https://www.riccardotartaglia.it/jkanban/

【讨论】:

    猜你喜欢
    • 2015-09-30
    • 2019-10-29
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-18
    相关资源
    最近更新 更多