Skip to content

Instantly share code, notes, and snippets.

@omernaci
omernaci / index.js
Created July 6, 2019 17:28
Morris.js Donut
var problemCount = [[${tawDto.problemCount}]];
var warningCount = [[${tawDto.warningCount}]];
var notReviewCount = [[${tawDto.notReviewCount}]];
$(document).ready(function() {
var browsersChart = Morris.Donut({
element: 'donut-example',
data: [
{label: "Problem", value: problemCount},
@omernaci
omernaci / index.js
Created June 18, 2019 08:17
Datatables Export Filter Option
/* https://datatables.net/extensions/buttons/examples/html5/excelAutoFilter.html */
...
$(document).ready( function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [ {
extend: 'excelHtml5',
autoFilter: true,
sheetName: 'Exported data'
} ]
@omernaci
omernaci / index.xhtml
Created June 10, 2019 06:46
JSF File Download Problem
...
/*https://stackoverflow.com/questions/15131582/jsf-file-download-doesnt-work*/
<h:commandButton value="download" action="#{myBean.download()}" />
<f:ajax disabled="true"/>
</h:commandButton>
...
@omernaci
omernaci / pom.xml
Created June 7, 2019 23:26
Eclipse Spring Boot 2.1.5 Maven Configuration Problem
...
<!-- https://bugs.eclipse.org/bugs/show_bug.cgi?id=547340 -->
<properties>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
</properties>
...
@omernaci
omernaci / ApplicationBean.java
Created May 20, 2019 09:00
JSF Excel File Download
...
ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext();
HttpServletResponse response = (HttpServletResponse) ectx.getResponse();
OutputStream out = response.getOutputStream();
response.setContentType("application/vnd.ms-excel");
String filename = "Failed_Users_"+ dateFormat.format(date).toString() + ".xls";
String attachmentName = "attachment; filename=\"" + filename + "\"";
response.setHeader("Content-disposition", attachmentName);
@omernaci
omernaci / index.html
Created February 19, 2019 13:45
Bootstrap Modal not close when click outside
...
<div id="idModal" class="modal hide" data-backdrop="static" data-keyboard="false">
...
@omernaci
omernaci / index.js
Created February 6, 2019 12:54
Datatable Column Manuel Width
$('.table').dataTable({
bAutoWidth: false,
aoColumns : [
{ sWidth: '15%' },
{ sWidth: '15%' },
{ sWidth: '15%' },
{ sWidth: '15%' },
{ sWidth: '15%' },
{ sWidth: '15%' },
{ sWidth: '10%' }
@omernaci
omernaci / style.css
Created January 30, 2019 10:12
JSF HTML Generate Id with column : CSS Selector
/*
The : is a special character in CSS identifiers,
it represents the start of a pseudo class selector like :hover, :first-child, etc. You would need to escape it.
*/
#phoneForm\:phoneTable {
background: pink;
}
@omernaci
omernaci / web.xml
Created December 7, 2018 13:17
JSF DateTimeConverter Default Timezone
...
<context-param>
<param-name>javax.faces.DATETIMECONVERTER_DEFAULT_TIMEZONE_IS_SYSTEM_TIMEZONE</param-name>
<param-value>true</param-value>
</context-param>
...
@omernaci
omernaci / number-validate.js
Created November 21, 2018 04:38
Jquery Number Validation only Allow Ctrl + V,C,S,X
$('#theField').on('keypress input', function() {
var value = $(this).val();
value = value.replace(/\D+/, ''); // removes any non-number char
$(this).val(value);
})