Я разрабатываю веб -приложение, где пользователи могут вводить данные в таблицу электронной таблицы, подобную пользовательскому интерфейсу, и нажимать на кнопку отправки, и данные хранятся в таблице баз данных MySQL. < /p>
i Создал проект с Vite и подготовьте базовый пользовательский интерфейс. Тем не менее, у меня проблемы с началом работы с реализацией Backend.my Main.js File выглядит так, как это < /p>
import './style.css';
import HyperFormula from 'hyperformula';
document.querySelector('#app').innerHTML = `
SUBMIT
`;
import Handsontable from 'handsontable';
import 'handsontable/dist/handsontable.full.min.css';
import { registerAllModules } from 'handsontable/registry';
registerAllModules();
const fakeDataset = [
{
id: 1,
name: 'John',
secondName: 'Doe',
age: 30,
location: 'New York',
},
];
const hyperformulaInstance = HyperFormula.buildEmpty({
// to use an external HyperFormula instance,
// initialize it with the `'internal-use-in-handsontable'` license key
licenseKey: 'internal-use-in-handsontable',
});
const container = document.querySelector('#example1');
const hot = new Handsontable(container, {
//data: fakeDataset, commenting this out will load mockup data
startCols: 9, //number of empty columns
startRows: 100, //numbver of empty rows
height: 500, //hight in pixels
colHeaders: [
'Date of Service',
'Claimant Number',
'Service Type',
'Quantity per Claimant',
'Pay Rate each',
'Pay Rate extended',
'Zip code',
'Mobile',
'E-mail',
], //can pass true to get default A,B,C column headers
columns: [
{
type: 'date',
dateFormat: 'MM/DD/YYYY',
correctFormat: true,
defaultDate: '01/01/1900',
// datePicker additional options
// (see https://github.com/dbushell/Pikaday#configuration)
datePickerConfig: {
// First day of the week (0: Sunday, 1: Monday, etc)
firstDay: 0,
showWeekNumber: true,
/*disableDayFn(date) {
// Disable Sunday and Saturday
return date.getDay() === 0 || date.getDay() === 6;
}*/ //this is to disable Sundays and Saturdays
},
},
{
type: 'text',
allowInvalid: false,
},
{
type: 'dropdown',
source: ['a', 'b', 'c', 'd', 'e', 'f'],
allowInvalid: false,
},
{
type: 'numeric',
allowInvalid: false,
},
{
type: 'numeric',
allowInvalid: false,
},
{
type: 'numeric',
source: 'PROD(D:E)',
allowInvalid: false,
},
],
rowHeaders: true, //this enables the 1, 2, 3 row headers
contextMenu: true, //this is a menu that will allow to add/remove row/column if you open it up with RMB on any cell
autoWrapRow: true, //this allows to move to another row with arrows when you are in the last cell
autoWrapCol: true, //this allows to move to another row with arrows when you are in the last cell
licenseKey: 'non-commercial-and-evaluation', //this is only for evaluation, after the purchase you will replace that with your own key
});
document.querySelector('.save').addEventListener('click', () => {
let alteredDataset = hot.getData();
console.log(alteredDataset);
//this is the place to send it back to the server
});
Вот как он выглядит в браузере. sstatic.net/k1m8w.png " /> < /p>
Я хочу реализовать функциональность, в которой пользователи могут ввести данные в сетку данных и нажать кнопку« Отправить », чтобы сохранить данные в базе данных MySQL Таблица с теми же полями. Я новичок в node.js, и я запутался в том, как начать.
Я разрабатываю веб -приложение, где пользователи могут вводить данные в таблицу электронной таблицы, подобную пользовательскому интерфейсу, и нажимать на кнопку отправки, и данные хранятся в таблице баз данных MySQL. < /p> i Создал проект с Vite и подготовьте базовый пользовательский интерфейс. Тем не менее, у меня проблемы с началом работы с реализацией Backend.my Main.js File выглядит так, как это < /p> [code]import './style.css'; import HyperFormula from 'hyperformula';
document.querySelector('#app').innerHTML = `
SUBMIT `;
import Handsontable from 'handsontable'; import 'handsontable/dist/handsontable.full.min.css'; import { registerAllModules } from 'handsontable/registry';
const hyperformulaInstance = HyperFormula.buildEmpty({ // to use an external HyperFormula instance, // initialize it with the `'internal-use-in-handsontable'` license key licenseKey: 'internal-use-in-handsontable', });
const container = document.querySelector('#example1'); const hot = new Handsontable(container, { //data: fakeDataset, commenting this out will load mockup data startCols: 9, //number of empty columns startRows: 100, //numbver of empty rows height: 500, //hight in pixels colHeaders: [ 'Date of Service', 'Claimant Number', 'Service Type', 'Quantity per Claimant', 'Pay Rate each', 'Pay Rate extended', 'Zip code', 'Mobile', 'E-mail', ], //can pass true to get default A,B,C column headers columns: [ { type: 'date', dateFormat: 'MM/DD/YYYY', correctFormat: true, defaultDate: '01/01/1900', // datePicker additional options // (see https://github.com/dbushell/Pikaday#configuration) datePickerConfig: { // First day of the week (0: Sunday, 1: Monday, etc) firstDay: 0, showWeekNumber: true, /*disableDayFn(date) { // Disable Sunday and Saturday return date.getDay() === 0 || date.getDay() === 6; }*/ //this is to disable Sundays and Saturdays }, }, { type: 'text', allowInvalid: false, }, { type: 'dropdown', source: ['a', 'b', 'c', 'd', 'e', 'f'], allowInvalid: false, }, { type: 'numeric', allowInvalid: false, }, { type: 'numeric', allowInvalid: false, }, { type: 'numeric', source: 'PROD(D:E)', allowInvalid: false, }, ], rowHeaders: true, //this enables the 1, 2, 3 row headers contextMenu: true, //this is a menu that will allow to add/remove row/column if you open it up with RMB on any cell autoWrapRow: true, //this allows to move to another row with arrows when you are in the last cell autoWrapCol: true, //this allows to move to another row with arrows when you are in the last cell licenseKey: 'non-commercial-and-evaluation', //this is only for evaluation, after the purchase you will replace that with your own key });
document.querySelector('.save').addEventListener('click', () => { let alteredDataset = hot.getData(); console.log(alteredDataset); //this is the place to send it back to the server }); [/code] Вот как он выглядит в браузере. sstatic.net/k1m8w.png " /> < /p> Я хочу реализовать функциональность, в которой пользователи могут ввести данные в сетку данных и нажать кнопку« Отправить », чтобы сохранить данные в базе данных MySQL Таблица с теми же полями. Я новичок в node.js, и я запутался в том, как начать.