Skip to content

Commit e72b420

Browse files
Fix: jquery implementation, lint, and build
1 parent 34b6aba commit e72b420

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

jQuery/src/index.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,8 @@ $(() => {
2727
data: index,
2828
group: 'tasksGroup',
2929
onAdd,
30-
onDragStart(e) {
31-
const selectedData = e.component.getSelectedRowsData();
32-
e.itemData = getVisibleRowValues(selectedData, e.component);
33-
e.cancel = !canDrag(e);
34-
},
35-
dragTemplate(dragData) {
36-
const itemsContainer = $('<table>').addClass('drag-container');
37-
dragData.itemData.forEach(((rowData) => {
38-
const itemContainer = $('<tr>');
39-
40-
Object.keys(rowData).forEach((field) => {
41-
itemContainer.append($('<td>').text(rowData[field]));
42-
});
43-
44-
itemsContainer.append(itemContainer);
45-
}));
46-
return $('<div>').append(itemsContainer);
47-
},
30+
onDragStart,
31+
dragTemplate,
4832
},
4933
scrolling: {
5034
mode: 'virtual',
@@ -73,6 +57,26 @@ $(() => {
7357

7458
$('#grid2').dxDataGrid(getDataGridConfiguration(2));
7559

60+
function onDragStart(e) {
61+
const selectedData = e.component.getSelectedRowsData();
62+
e.itemData = getVisibleRowValues(selectedData, e.component);
63+
e.cancel = !canDrag(e);
64+
}
65+
66+
function dragTemplate(dragData) {
67+
const itemsContainer = $('<table>').addClass('drag-container');
68+
dragData.itemData.forEach(((rowData) => {
69+
const itemContainer = $('<tr>');
70+
71+
Object.keys(rowData).forEach((field) => {
72+
itemContainer.append($('<td>').text(rowData[field]));
73+
});
74+
75+
itemsContainer.append(itemContainer);
76+
}));
77+
return $('<div>').append(itemsContainer);
78+
}
79+
7680
function onAdd(e) {
7781
const selectedRowKeys = e.fromComponent.getSelectedRowKeys();
7882
const updateProcess = [];
@@ -115,16 +119,16 @@ $(() => {
115119
const selectedData = rowsData.map((rowData) => {
116120
const visibleValues = {};
117121
visibleColumns.forEach((column) => {
118-
if(column.dataField){
122+
if (column.dataField) {
119123
visibleValues[column.dataField] = getVisibleCellValue(column, rowData);
120124
}
121125
});
122-
return visibleValues;
126+
return visibleValues;
123127
});
124128
return selectedData;
125129
}
126130

127-
function getVisibleCellValue(column, rowData){
131+
function getVisibleCellValue(column, rowData) {
128132
const cellValue = rowData[column.dataField];
129133
return column.lookup ? column.lookup.calculateCellValue(cellValue) : cellValue;
130134
}

0 commit comments

Comments
 (0)