Export to Excel not working when deployed - asp.net-mvc

This is the code I used to create a data table with export functionality.
oTable = $("#tblSearch").DataTable({
"jQueryUI": true,
"sPaginationType": "full_numbers",
"iDisplayLength": 10,
"bSort": true,
"aaSorting": [[0, "desc"]],
"lengthMenu": [[5, 10, 25, 50], [5, 10, 25, 50]],
"autoWidth": true,
"scrollCollapse": true,
"dom": 'T<"clear">lfrtip',
"tableTools": {
"sSwfPath": "../../swf/copy_csv_xls.swf",
"aButtons": ["xls"]
}
});
Export is working in my local but when I deployed in server, the button does not appear.

Change the sSwfPath to an absolute path.
"tableTools": {
"sSwfPath": "http://cdn.datatables.net/tabletools/2.2.3/swf/copy_csv_xls_pdf.swf",
"aButtons": ["xls"]
}
here using the dataTables CDN. The problem is, that the relative path messes up when you deploy to your IIS or whatever windows platform you are using. This is a very common problem.

Related

The editor auto-complete function of NEO4J 4.4 is not working

The editor auto-complete functionality of NEO4J is not working although the config setting is set to "true"
config editorAutocomplete:true
{
"maxHistory": 30,
"theme": "auto",
"initCmd": ":play start",
"playImplicitInitCommands": true,
"initialNodeDisplay": 300,
"maxNeighbours": 100,
"showSampleScripts": true,
"browserSyncDebugServer": null,
"maxRows": 1000,
"maxFieldItems": 500,
"autoComplete": true,
"scrollToTop": true,
"maxFrames": 15,
"codeFontLigatures": true,
"useBoltRouting": false,
"editorLint": false,
"enableMultiStatementMode": true,
"connectionTimeout": 30000,
"showPerformanceOverlay": false,
"allowCrashReports": true,
"allowUserStats": true,
"showWheelZoomInfo": true,
"useCypherThread": true,
# **"editorAutocomplete": true**
This is set to true by default for the NEO4J browser, however it is not working in NEO4J 4.4 as it did in NEO4J 3.2.
I tried to change the setting, but it had no effect. I refreshed the browser and still nothing.

Bug onSelectRow in free-jqgrid

I use free-jqGrid v4.14.0. I have a table, when I click on a row in this table, I execute a stored procedure and in another table I enter the result.
The problem is that when you first click on a row in the table, the data does not load into the second table, and when the second button is clicked, the data appears, and this problem occurs only once, the following clicks immediately load the data into the second table.
When you first click in the browser console, you can see that the url stored procedure is loading: '# Url.Action ("GetAccident")',
$(document).ready(function () {
$("#jqg").jqGrid({
url: '#Url.Action("GetAccident")',
datatype: "json",
colNames: ['id_Accident', .......],
colModel: [
{ name: 'id_Accident', index: 'id_Accident', autowidth: true, sortable: false },
.....................
.....................
],
guiStyle: "bootstrap",
iconSet: "fontAwesome",
pager: "#pager",
rowList: [10, 20, 30],
rowNum: 10,
loadonce: false,
onSelectRow:
function (idRow) {
celValue = $('#jqg').jqGrid('getCell', idRow, 'id_Accident');
jQuery("#jqg1").jqGrid('setGridParam', { url: '#Url.Action("GetOrganizationCulpritByIdAccident")?celValue=' + celValue, page: 1 }).trigger('reloadGrid');
}
});
jQuery("#jqg1").jqGrid({
url: '#Url.Action("GetOrganizationCulpritByIdAccident")?celValue=' + 0,
datatype: "json",
colNames: ['id_Accident', 'Name Organization'],
colModel: [
{ name: 'id_Accident', index: 'id_Accident', autowidth: true, stype: 'text', sortable: true },
{ name: 'Name', index: 'Name', autowidth: true, sortable: true }
],
guiStyle: "bootstrap",
pager: "#pager1",
rowList: [10, 20, 30],
rowNum: 10,
});
I can't reproduce the problem. You can examine Network traffic of the demo https://jsfiddle.net/OlegKi/ed0yLkce/1/. I uses
datatype: "local"
in the second grid as initial option to prevent unneeded Ajax requests. I use additionally idPrefix with different values in both grids to be sure that one will have no conflicts with duplicates of ids. You will see in Network tab of Developer Tools that the request to for example https://fiddle.jshell.net/echo/json?celValue=test2 will be send it the second row is selected.

Custom Google Maps styling not working on iPad

I'm working on a site that has some custom Google Maps styling on a map on the homepage. You can find the site here: toptourist.com
However, when you view the site on an iPad (or other tablets, probably), the map changes and doesn't have the same styles as it does on the desktop.
I've looked through the files and can't see any reason why this is happening so just wondered if any bright sparks on here can help?
The function that builds the map is quite lengthy so I'm loathed to paste the whole thing here, but here's a snippet:
var mapOptions = {
center: myLatlng,
zoom: 12,
scrollwheel: false,
zoomControl: false,
minZoom: 1,
maxZoom: 15,
panControl: false,
navigationControl: false,
scaleControl: false,
mapTypeControl: false,
streetViewControl: false,
overviewMapControl: false
};
var bounds = new google.maps.LatLngBounds();
var map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
var styles = [
{
stylers: [
{ hue: "#765910" },
{ saturation: -20 }
]
},{
featureType: "road",
elementType: "geometry",
stylers: [
{ lightness: 100 },
{ visibility: "simplified" }
]
},{
featureType: "road",
elementType: "labels",
stylers: [
{ visibility: "off" }
]
}
];
map.setOptions(
{styles: styles}
);
I think your style works across different devices. I paste it on the jsfiddle and it looks fine on android, ios and desktop. Plus, if you tab on the address bad and request for a desktop page, you get what you expected.
Looking at your source code, rather than the Google Maps Style, I think the problem is in your initialize_for_device code. Your site has 2 different div for mobile and desktop, but I think you have only one set of css for map-canvas, but not the map-canvas_device. That could be the problem.

jQuery DataTables v1.10 + Rails ajax data

RailsCasts episode 340 on DataTables was interesting, but with the release of DataTables v1.10, lots have changed. Ajax is simpler but API's are easier to configure. Does anyone have examples of Rails code that creates Ajax data for DataTables? It'll be useful if it can be used for sorting, searching, in addition to pagination.
Yes, it is very useful for sorting ,searching and also pagination both for client side as well as serverside but not at the same time.
It is a very good plugin(gem), I have used it.
Example:-Ajax data for datatable
var table = $("#example_id").DataTable({
iDisplayLength: 100,
bInfo: false,
bSort: true,
sPaginationType: "full_numbers",
bStateSave: true,
bDestroy: true,
bProcessing: true,
bServerSide: true,
bFilter: false,
sAjaxSource: '/example/action_name',
fnServerParams: function (aoData) {
aoData.push(
{ "name": "example1", "value": $("#_example1").val() },
{ "name": "example2", "value": 5 },
{ "name": "example3", "value": "My Name" }
);
},
oLanguage:{
sZeroRecords: "No records found."},
"sDom": 'rtlfip'
});
Hope this will help you!!

jqgrid TreeGrid unable to see content of expanded column

I have problem while rendering expanded column text while using jQuery jqgrid's treegrid type. Here's my treegrid definition and the response from server, I'll be happy if someone can help me?
Thanks in advance.
Javascript
menuGrid.jqGrid({
url:'kullanici/loadMenu.ajax',
//enable TreeGrid
treeGrid: true,
//set TreeGrid model
treeGridModel: 'adjacency', //'nested', //'adjacency',
//set expand column
ExpandColumn: 'Text',
width: 550,
datatype: 'json',
viewrecords: true,
loadonce: true,
colNames: ['ID', 'Text'],
colModel: [
{ name: 'id', index: 'id', width: 20, align: 'left', editable: false, key: true, sorttype:'int', hidden: false },
{ name: 'Text', index: 'menuName', width: 120, sortable: true, align: 'left' }
],
jsonReader: {
repeatitems : false,
id: 'id'
},
sortname: 'id',
sortorder: 'asc',
height: 200,
sortable: true,
enabletooltips: true,
caption: 'Menü Ağacı'
});
menuGrid.jqGrid('navGrid','#paddtree');
The JSON response from server
{"rows":[{"expanded":true,"id":1,"isLeaf":false,"level":0,"loaded":true,"text":"Kullanici Islemleri"},{"expanded":false,"id":2,"isLeaf":true,"level":1,"loaded":true,"parent":1,"text":"Kullanici Ekle"},{"expanded":false,"id":3,"isLeaf":true,"level":1,"loaded":true,"parent":1,"text":"Kullanici Duzenle"},{"expanded":false,"id":4,"isLeaf":true,"level":1,"loaded":true,"parent":1,"text":"Kullanici Sil"},{"expanded":true,"id":5,"isLeaf":false,"level":0,"loaded":true,"text":"Fatura ??lemleri"},{"expanded":false,"id":6,"isLeaf":true,"level":1,"loaded":true,"parent":5,"text":"Fatura Goruntule"}],"records":6,"success":true}
Your Json response must be as follows :
{"rows":[
{
"id":1,
"text":"Kullanici Islemleri"
"level":0,
"isLeaf":false,
"parent" : "null" //If the row is at 0-lvl
"expanded":true,
"loaded":true,
},
],"records":6,"success":true}
You have to respect the order of the grid cols.
First, your data cols, then, level,isLeaf, parent,expanded. I'm not sure about the loaded field, try with and without.
OK,I have found the solution, colNames, colModel and ExpandColumn configs should match(case-sensitive). As I said above the order of config isn't important.

Resources