electron has blue outline/frame when launch - electron

I want to use the same window outline like vscode:
but here is my window at launch
my window config
new BrowserWindow({
minHeight: 400,
minWidth: 600,
center: true,
frame: false,
backgroundColor: "#fff",
webPreferences: {
spellcheck: false,
webSecurity: true,
nodeIntegration: true,
contextIsolation: false,
enableWebSQL: false,
images: false,
webgl: false,
},
});
deps:
"electron": "17.0.0",
"electron-builder": "^22.14.13"

OMG, I did it!!!!
// #ts-check
const { BrowserWindow, app } = require("electron");
const path = require("path");
const { Library } = require("ffi-napi");
app.disableHardwareAcceleration();
function createWindow() {
return new BrowserWindow({
minHeight: 400,
minWidth: 600,
center: true,
frame: false,
show: true,
backgroundColor: "#fff",
webPreferences: {
spellcheck: false,
webSecurity: true,
nodeIntegration: true,
contextIsolation: false,
},
});
}
async function openWindow() {
const win = createWindow();
// ffi - napi;
var ffi = Library("user32.dll", {
SetWindowLongA: ["int", ["int", "int", "long"]],
SetWindowPos: ["int", ["int", "int", "int", "int", "int", "int", "int"]],
});
// THICK frame
const WS_THICKFRAME = 0x00040000;
// show window
const SWP_SHOWWINDOW = 0x0040;
// draw a thick frame
ffi.SetWindowLongA(win.getNativeWindowHandle().readUint32LE(), -16, WS_THICKFRAME);
// show window
ffi.SetWindowPos(win.getNativeWindowHandle().readUint32LE(), 0, 0, 0, 0, 0, SWP_SHOWWINDOW);
win.center();
if (app.isPackaged) {
await win.loadFile("public/index.html");
} else {
await win.loadURL("http://localhost:3000");
}
return win;
}
exports.createWindow = createWindow;
exports.openWindow = openWindow;

Related

Card layout issue

Card layout is display to top right of the application. I need to make it to appear center of the screen.
I have tried setting up the layout
align: 'center'
&
pack: 'center'
No go.
Ext.define('DataARCH.view.data.RestConnectionPopup', {
extend: 'Ext.window.Window',
alias: 'widget.restConnectionPopup',
// autoShow: 'true',
// bodyStyle: {
// background: 'white'
// },
// height: 460,
// width: 380,
// title: config.BRAND_SHORT + ' Publisher: REST Connection',
// constrain: true,
// resizable: false,
controller: 'publishdatacontrol',
initComponent: function () {
//Card Layout
console.log("helo");
var cards = Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
requires: ['Ext.layout.container.Card'],
layout:
{
type: 'card',
align: 'center'
//pack: 'center'
},
region: 'center',
width: 600,
height: 200,
bodyPadding: 15,
defaults: {
border: false
},
defaultListenerScope: true,
Fixed my removing the following lines.
renderTo: Ext.getBody(),
region: 'center',
width: 600,
height: 200

DataTables has not rendering image

i'm trying show image in datatable, but i have a troubles with rendering image, how i may fixed it?
i'm using Django
$(document).ready(function() {
var datatable = $("#asins_list").DataTable({
"bServerSide": true,
"sAjaxSource": links.ajax_get_asins_list,
"bProcessing": true,
"bLengthChange": true,
"bFilter": false,
'sDom': 'Bfrtip',
"bSortable": false,
"bSearch": false,
"autoWidth": true,
"ordering": false,
"bInfo": false,
"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]],
"iDisplayLength": 10,
responsive: true,
"aoColumnDefs": [{
"targets": 0,
"data": "remark",
"render": function ( data, type, row, meta ) {
// return 'Download';
return '<a href="test.png"><img src="test.png" ' +
'><b>Competed</b></a>';
}
}],
});
You did not indicate which version you are using, so I assume its the latest (1.10.18).
In that case please note that aoColumnDefs no longer exists, it is now just ColumnDefs.

Vue project: object does not support this property or method "hasOwnProperty" IE11

I was developing a vue app using vue advanced webpack template and I didn't took much attention to IE browser but today I tried and I'm getting very odd errors.
I have a several sparkline charts rendered with Highcharts in the mount function of a component and I think the point where I have this error is here:
options = Highcharts.merge(defaultOptions, options);
I use babel-polyfill and my .babelrc configuration is this one:
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": [
"Chrome >= 52",
"FireFox >= 44",
"Safari >= 7",
"Explorer 11",
"last 4 Edge versions"
]
},
"useBuiltIns": true,
"debug": true
}],
"stage-2"
],
"plugins": ["transform-vue-jsx", "transform-runtime"],
"env": {
"test": {
"presets": ["env", "stage-2"],
"plugins": ["transform-vue-jsx", "transform-es2015-modules-commonjs",
"dynamic-import-node"]
}
}
}
In webpack.base.config.js I have this loader configured:
{
test: /\.js$/,
loader: 'babel-loader',
include: [resolve('src'), resolve('i18n'), resolve('test'),
resolve('node_modules/webpack-dev-server/client')]
},
Any help will be appreciated, thanks!
Relevant Source of List.vue:
import createSmallCharts from './smallChart';
function refreshCharts(elements) {
createSmallCharts(elements);
}
...
mounted() {
const elements = this.$refs['currency-table-
body'].querySelectorAll('.table__price-graph');
refreshCharts(elements);
},
And the source for createSmallCharts
import * as Highcharts from 'highcharts/highcharts';
// Creating 153 sparkline charts is quite fast in modern browsers, but IE8 and mobile
// can take some seconds, so we split the input into chunks and apply them in timeouts
// in order avoid locking up the browser process and allow interaction.
function createSmallCharts(elements) {
const time = +new Date();
let stringdata;
let data;
let n = 0;
for (let i = 0; i < elements.length; i += 1) {
const element = elements[i];
stringdata = element.getAttribute('data-sparkline');
data = stringdata.split(', ').map(dataEl => parseFloat(dataEl));
Highcharts.SparkLine(element, {
series: [{
data,
pointStart: 1,
pointInterval: 24 * 3600 * 1000,
fillColor: {
linearGradient: {
x1: 0,
y1: 0,
x2: 0,
y2: 1,
},
},
}],
plotOptions: {
series: {
marker: {
enabled: false,
states: {
hover: {
enabled: true,
radius: 3,
},
},
},
},
},
tooltip: {
formatter: () => false,
},
});
// If the process takes too much time, run a timeout to allow interaction with the browser
if (new Date() - time > 500) {
elements.splice(0, i + 1);
setTimeout(createSmallCharts, 0);
break;
}
}
}
export { createSmallCharts as default };
Finnaly the definition of SparkLine:
import Highcharts from 'highcharts/highcharts';
Highcharts.SparkLine = function SparkLine(...params) {
const hasRenderToArg = typeof a === 'string' || params[0].nodeName;
let options = params[hasRenderToArg ? 1 : 0];
const defaultOptions = {
chart: {
renderTo: (options.chart && options.chart.renderTo) || this,
backgroundColor: null,
borderWidth: 0,
type: 'area',
margin: [2, 0, 2, 0],
width: 120,
height: 20,
style: {
overflow: 'visible',
},
// small optimalization, saves 1-2 ms each sparkline
skipClone: true,
},
title: {
text: '',
},
credits: {
enabled: false,
},
xAxis: {
labels: {
enabled: false,
},
title: {
text: null,
},
startOnTick: false,
endOnTick: false,
tickPositions: [],
},
yAxis: {
endOnTick: false,
startOnTick: false,
labels: {
enabled: false,
},
title: {
text: null,
},
tickPositions: [0],
},
legend: {
enabled: false,
},
tooltip: {
backgroundColor: null,
borderWidth: 0,
shadow: false,
useHTML: true,
hideDelay: 0,
shared: true,
padding: 0,
positioner(w, h, point) {
return {
x: point.plotX - (w / 2),
y: point.plotY - h,
};
},
},
plotOptions: {
series: {
animation: false,
lineWidth: 1,
shadow: false,
states: {
hover: {
lineWidth: 1,
},
},
marker: {
radius: 1,
states: {
hover: {
radius: 2,
},
},
},
fillOpacity: 0.25,
},
column: {
negativeColor: '#910000',
borderColor: 'silver',
},
},
};
options = Highcharts.merge(defaultOptions, options); // I think ERROR is here
return hasRenderToArg ?
new Highcharts.Chart(params[0], options, params[2]) :
new Highcharts.Chart(options, params[1]);
};
Try to import it at the top of your main.js file like this:
import 'babel-polyfill'
At least this fixed this issue for me.

jqgrid not showing any results when count exceeds ~9000

I am using jqgrid version 4.1.2 with MVC4, using loadonce option. When the search result's count exceeds approximately 9000 records, no data is shown up on the grid.
What might be the issue?
Here is the JS code: Update 1
function showCompletedGrid() {
// Set up the jquery grid
$("#jqTableCompleted").jqGrid({
// Ajax related configurations
url: jqDataUrl,
datatype: "json",
mtype: "POST",
loadonce: true,
loadtext: 'Loading Data please wait ...',
postData: { strUserName: function () { return $('#ddlUserName :selected').val(); },
strFunctionName: function () { return $('#ddlOPMSFunction :selected').text(); },
strProcName: function () { return $('#ddlOPMSProcess :selected').text(); },
strCategory: function () { return $('#ddlSearchCategory :selected').text(); },
strWorkType: function () { return $('#ddlSearchWorkType :selected').text(); },
strRequestNumber: function () { return $('#txtRequestNo').val(); },
strStatus: function () { return $('#ddlSearchStatus :selected').text(); },
strFromDate: function () { return $('#txtFromDate').val().toString(); }, //datepicker('getDate'),
strToDate: function () { return $('#txtToDate').val().toString(); }, //datepicker('getDate'),
strAction: "Closed"
},
autowidth: true,
shrinkToFit: true,
// Specify the column names
colNames: ["S.No.", "User Name", "Category", "Work Type", "Request Number", "Status", "Time Spent", "RE", "GUID", "Marked for Correction", "Correction Complete", "Reason", "Task Type", "acf2id", "Created Date", "Action", "IsTeam"],
// Configure the columns
colModel: [
{ name: "SNo", index: "SNo", sorttype: 'int', width: 100, align: "left", hidden: true, sortable: true, search: true, searchoptions: { sopt: ['eq']} },
{ name: "UserName", index: "UserName", width: 200, align: "left", sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "Category", index: "Category", width: 200, align: "left", sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "WorkType", index: "WorkType", width: 200, align: "left", sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "RequestNumber", index: "RequestNumber", width: 200, align: "left", sortable: true, search: true, searchoptions: { sopt: ['cn']} },
{ name: "Status", index: "Status", width: 200, align: "left", sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "TimeSpent", index: "TimeSpent", width: 200, align: "left", sortable: true, search: true },
{ name: "RE", index: "RE", width: 200, align: "left", sortable: true, search: true },
{ name: "GUID", index: "GUID", sortable: false, search: false, width: 200, align: "left", hidden: true },
{ name: "MarkCorrection", index: "MarkCorrection", width: 200, align: "left", hidden: true, sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "CorrectionComplete", index: "CorrectionComplete", width: 200, align: "left", hidden: true, sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "Reason", index: "Reason", width: 200, align: "left", hidden: true, sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "TaskType", index: "TaskType", width: 200, align: "left", sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "acf2id", index: "acf2id", width: 200, align: "left", hidden: true, sortable: true, search: true, sorttype: 'string', searchoptions: { sopt: ['cn']} },
{ name: "CreatedDate", index: "CreatedDate", width: 200, align: "left", hidden: false, search: false },
{ name: 'Actions', sortable: false, search: false, fixed: true, align: 'center', formatter: returnHyperLinkCompleted },
{ name: 'IsTeam', sortable: false, hidden: true, search: false, fixed: true, align: 'center' }
],
ignoreCase: true,
//width: 1250,
height: 150,
// Paging
toppager: true,
pager: $("#jqTableCompletedPager"),
//rowTotal: 200,
rowNum: 20,
rowList: [20, 15, 10, 5],
viewrecords: true,
emptyrecords: "",
hiddengrid: true,
// Default sorting
sortname: "SNo",
sortorder: "asc",
// Grid caption
caption: "Closed",
loadComplete: function (data) {
var RE;
var TimeSpent;
var rowIDs = jQuery("#jqTableCompleted").jqGrid('getDataIDs');
for (var i = 0; i < rowIDs.length; i++) {
var rowID = rowIDs[i];
var row = jQuery('#jqTableCompleted').jqGrid('getRowData', rowID);
RE = hmsToSecondsOnly(row.RE);
RE = (0.2 * RE) + RE;
TimeSpent = hmsToSecondsOnly(row.TimeSpent);
if (TimeSpent > RE && RE > 0) {
$(row).removeClass('ui-widget-content');
$(row).removeClass('ui-state-highlight');
$("#jqTableCompleted tr[id='" + rowID + "']").addClass('myColor');
}
}
}
}).navGrid("#jqTableCompletedPager",
{ refresh: true, add: false, edit: false, del: false },
{}, // settings for edit
{}, // settings for add
{}, // settings for delete
{sopt: ["cn"]}
);
$("#jqTableCompleted").jqGrid('navGrid', '#jqTableCompletedPager', { del: false, add: false, edit: false, search: false });
$("#jqTableCompleted").jqGrid('filterToolbar', { searchOnEnter: false, searchOperators: true });
$("#jqTableCompleted").jqGrid('navButtonAdd', '#jqTableCompletedPager',
{ caption: "Export to Excel", buttonicon: "ui-icon-extlink", title: "Export", id: "btnExport",
onClickButton: function (evt) {
var UserName = $('#ddlUserName option:selected').val();
var RequestNumber = $('#txtRequestNo').val();
var FunctionName = encodeURIComponent($('#ddlOPMSFunction option:selected').text());
var ProcessName = encodeURIComponent($('#ddlOPMSProcess option:selected').text());
var Category = $('#ddlSearchCategory option:selected').text();
var WorkTypeName = $('#ddlSearchWorkType option:selected').text();
var SearchStatus = $('#ddlSearchStatus option:selected').text();
var TransactionStartTS = $('#txtFromDate').val().toString();
var TransactionEndTS = $('#txtToDate').val().toString();
window.open("../Search/Export?UserName=" + UserName + "&RequestNumber=" + RequestNumber + "&FunctionName=" + FunctionName + "&ProcessName=" + ProcessName + "&Category=" + Category + "&WorkTypeName=" + WorkTypeName + "&SearchStatus=" + SearchStatus + "&TransactionStartTS=" + TransactionStartTS + "&TransactionEndTS=" + TransactionEndTS + "&ActionName=" + "Closed");
}
});
}
Although the data is being returned and in the correct format, from the controller, as follows, the grid does not show any result.
var jsonData = new
{
page = page,
rows = data
};
return Json(jsonData, JsonRequestBehavior.AllowGet);
Also is there any limit on number of records or dependency on the browser when returning all the data from server using the loadonce option?
Any help would be much appreciated. Thanks.
Finally I found the solution for the above problem by tracing the request in Fiddler, in the response title following error was shown:
Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
Upon searching for the above error, I found a workaround:
Here
Basically the problem area was not the jqGrid, but was MaxJsonLength property of JavaScriptSerializer which defaults to 2097152 characters ~ 4 MB of data. Source: MaxJsonLength
To get it working, I replaced the following code in my Action method:
return Json(jsonData, JsonRequestBehavior.AllowGet);
with:
var jsonResult = Json(jsonData, JsonRequestBehavior.AllowGet);
jsonResult.MaxJsonLength = int.MaxValue;
return jsonResult;
Thanks.

Multiple JQuery.datepicker on Dialog MVC 2

I am currently running the following code:
<script type="text/javascript">
$(document).ready(function() {
var updateDialog = {
url: '<%= Url.Action("ABM", "Periodo") %>'
, closeAfterAdd: true
, closeAfterEdit: true
, modal: true
, afterShowForm: function(formId) {
$("#fecha_inicio").datepicker({ autoSize: true, showOn: 'both', dateFormat: 'dd/mm/yy' });
$("#fecha_fin").datepicker({ autoSize: true, showOn: 'both', dateFormat: 'dd/mm/yy' });
}
, onclickSubmit: function(params) {
var ajaxData = {};
var list = $("#list");
var selectedRow = list.getGridParam("selrow");
rowData = list.getRowData(selectedRow);
ajaxData = { periodoNum: rowData.periodoId };
return ajaxData;
}
, width: "400"
};
$.jgrid.nav.addtext = "Agregar";
$.jgrid.nav.edittext = "Editar";
$.jgrid.nav.deltext = "Borrar";
$.jgrid.edit.addCaption = "Agregar Periodo";
$.jgrid.edit.editCaption = "Editar Periodo";
$.jgrid.del.caption = "Borrar Periodo";
$.jgrid.del.msg = "Borrar el periodo seleccionado?";
$("#list").jqGrid({
url: '<%= Url.Action("List", "Periodo") %>',
datatype: 'json',
mtype: 'GET',
colNames: ['NĂºmero', 'Desde Fecha', 'Hasta Fecha', 'Activo'],
colModel: [
{ name: 'periodoId', index: 'periodoId', width: 40, align: 'left', editable: false, editrules: { edithidden: false }, hidedlg: true, hidden: true },
{ name: 'fecha_inicio', index: 'fecha_inicio', formatter: 'date', datefmt: 'd/m/Y', width: 100, align: 'left', editable: true, edittype: 'text', editoptions: { size: 10, maxlength: 10 }, editrules: { required: true }, formoptions: { elmsuffix: ' *'} },
{ name: 'fecha_fin', index: 'fecha_fin', formatter: 'date', datefmt: 'd/m/Y', width: 100, align: 'left', editable: true, edittype: 'text', editoptions: { size: 10, maxlength: 10 }, editrules: { required: true }, formoptions: { elmsuffix: ' *'} },
{ name: 'activo', index: 'activo', width: 100, align: 'left', editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, editrules: { required: false} },
],
pager: $('#listPager'),
rowNum: 20,
rowList: [5, 10, 20],
sortname: 'id',
sortorder: "desc",
viewrecords: true,
imgpath: '/Content/ui-lightness/Images',
width: "900",
height: "400",
ondblClickRow: function(rowid, iRow, iCol, e) {
$("#list").editGridRow(rowid, prmGridDialog);
}
}).navGrid('#listPager',
{
edit: true, add: true, del: true, search: false, refresh: true
},
updateDialog,
updateDialog,
updateDialog
);
});
</script>
But when data entry is only possible using only the datepicker of fecha_inicio.
I have read several examples web, but could not find the solution, What am I doing wrong?
apparently the point of failure occurred with
showOn: 'both'
when it was changed to
showOn: 'button'
worked correctly

Resources