#jquery #datatables
#jquery #datatables
Вопрос:
Я работаю с таблицами данных и сталкиваюсь с проблемой разбиения на страницы.
Вот мой код таблиц данных:
$('#example1').DataTable({ data: [result], // Array "scrollX": true, "pagingType": "full_numbers", "paging": true, Paginate: true, "lengthChange": true, "lengthMenu": [10, 25, 50, 75, 100], length: 10, columns: [{ data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("name")) { return data = result['name'].join('') //return data } else { return null } //return data }, //title: 'Name', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("job_title")) { return data = result['job_title'].join('') //return data } else { return null } //return data }, //title: 'Designation', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("gender")) { return data = result['gender'].join('') //return data } else { return null } //return data }, // title: 'Gender', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("manager_name")) { return data = result['manager_name'].join('') //return data } else { return null } //return data }, // title: 'Manager Name', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("marital")) { return data = result['marital'].join('') //return data } else { return null } //return data }, //title: 'Marital Status', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("children")) { return data = result['children'].join('') //return data } else { return null } //return data }, //title: 'Children', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("personal_mail_id")) { return data = result['personal_mail_id'].join('') //return data } else { return null } //return data }, //title: 'Email Id', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("aadhar_no")) { return data = result['aadhar_no'].join('') //return data } else { return null } //return data }, //title: 'Aadhar Number', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("employee_code")) { return data = result['employee_code'].join('') //return data } else { return null } //return data }, //title: 'Employee Code', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("employee_primary_skill_id")) { return data = result['employee_primary_skill_id'].join('') //return data } else { return null } //return data }, //title: 'Primary Skill', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("pan_no")) { return data = result['pan_no'].join('') //return data } else { return null } //return data }, //title: 'Pan No.', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("permanent_addr")) { return data = result['permanent_addr'].join('') //return data } else { return null } //return data }, //title: 'Permanent Address', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("experience_before_engro")) { return data = result['experience_before_engro'].join('') //return data } else { return null } //return data }, //title: 'Experience Before Engro', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("employment_type")) { return data = result['employment_type'].join('') //return data } else { return null } //return data }, //title: 'Employment Type', }, { data: null, render: function (data) { tags = $('#tags').val().split(",") //console.log(tags, "ssss") if (tags.includes("total_experience")) { return data = result['total_experience'].join('') //return data } else { return null } //return data }, //title: 'Employment Type', }, ], searching: false, destroy: true, //retrieve: true, });
В части разбиения на страницы говорится::
Отображение от 1 до 1 из 1 записей
Хотя все сведения о данных извлекаются с помощью объекта result.
Любая помощь будет признательна.
Моя HTML-страница (базовая структура HTML-страницы присутствует, но здесь не добавлена).:
lt;table id="example1" class="display" style="width:100%"gt; lt;theadgt; lt;trgt; lt;thgt; Name lt;/thgt; lt;thgt; Designation lt;/thgt; lt;thgt; Gender lt;/thgt; lt;thgt; Manager Namelt;/thgt; lt;thgt; marital Statuslt;/thgt; lt;thgt; Childrenlt;/thgt; lt;thgt; Personal Mail IDlt;/thgt; lt;thgt; Aadhar No.lt;/thgt; lt;thgt; Employee ID lt;/thgt; lt;thgt; Primary Skill lt;/thgt; lt;thgt; Pan No. lt;/thgt; lt;thgt; Permanent Addresslt;/thgt; lt;thgt; Experience Before Engrolt;/thgt; lt;thgt; Employment Typelt;/thgt; lt;thgt; Total Experiencelt;/thgt; lt;/trgt; lt;/theadgt; lt;tbodygt; lt;/tbodygt; lt;/tablegt;