Hi,
I am not sure how to implement below requirement in MVC.
Requirement:
Upon selecting "show more rows" option in jQuery datatables (entries dropdown), the selection shall remain throughout the application (like a session in Asp.Net) until user re-selects or closes the application.
https://i.ibb.co/mNwf8Q9/Capture2.png
$(document).ready(function () {
GetGridData("", "", "");
bindGrid(gridDataOperation);
})
function GetGridData(study, scenario) {
var actionUrl = "@Url.Action("BindWellGridData", "MappingWell")";
$.ajax({
url: actionUrl,
type: 'GET',
dataType: 'json',
async: false,
cache: false,
data: { study: study, scenario: scenario },
success: function (responseData) {
gridDataOperation = responseData;
console.log(responseData);
},
error: function (xhr, ajaxOptions, thrownError) {
},
beforeSend: function (jqXHR, settings) {
},
complete: function (jqXHR, textStatus) {
},
});
}
function bindGrid(gridData) {
if (window.location.href.match(/(\d+)$/g) != null) {
var id = window.location.href.match(/(\d+)$/g)[0];
$('#hfId').val(id);
}
grdTable = $('#DT_grdCreateWell').DataTable({
data: gridData,
order: [[0, "desc"]],
columns: [
{ title: "FdpWellId", data: 'fdpWellId', "autoWidth": true },
{ title: "Study", data: 'studyName', "autoWidth": true },
{ title: "Scenario", data: 'scenarioName', "autoWidth": true },
{ title: "Well Name", data: 'wellName', "autoWidth": true },
],
processing: true, //show progress bar
filter: false, //disable filter (search box)
searching: true, //Disable searching abilities in DataTables
lengthChange: false, //Disable Record number per page
info: false, //Will hide "1 to n of n entries" Text at bottom
ordering: false, //disable sorting here
pageLength: 5,
columnDefs: [
{
//hiding the Primary key of the table and also unsearchable.
targets: [0],
visible: false,
searchable: false
}
],
"createdRow": function (row, data, dataIndex) {
if (data.fdpWellId == $('#hfId').val()) {
$('#hfId').val('');
$(row).css('background-color', '#e0fde0');
}
}
});
}
I know to achieve the same in Asp.Net using session but how to achieve it in Core MVC?
Thank you so much in advance