Chandra Oemaryadi has written 244 articles

NPOI Generate Excel with Date Format

Jika kita ingin memasukkan object DateTime ke dalam cell menggunakan NPOI, perlu ada penanganan khusus. [code language=”csharp”] XSSFCellStyle styleDate = (XSSFCellStyle)workbook.CreateCellStyle(); styleDate.DataFormat = workbook.CreateDataFormat().GetFormat("yyyy-mm-dd HH:mm"); XSSFCell cell = (XSSFCell)row.CreateCell(colIndex++); cell.SetCellValue(single.Timestamp); cell.CellStyle = styleDate; [/code] http://stackoverflow.com/questions/3425931/npoi-excel-number-format-not-showing-in-excel-sheet-in-asp-net

Kendo Grid ParameterMap

Fungsi parameter map pada Kendo Grid bermanfaat untuk filter / sort foreign key. [code language=”javascript”] var dataSource = new kendo.data.DataSource( { transport: { read: { url: "@Url.Action("Binding")", dataType: "json", }, parameterMap: function (options, operation) { if (operation !== "read" && options.models) { } else { if (options.filter) { filter = options.filter.filters; for (var i in…

Kendo UI Grid Custom Filter Type

Beberapa contoh custom filter type pada Kendo Grid 1. Date [code language=”javascript”] columns: [ //… { field: "LastUpdate", title: "Last Update", filterable: { ui: "datepicker", operators: { string: { eq: "Equals", }, }, extra: false, } //… ] [/code] 2. Dropdown [code language=”javascript”] function typeCourse(element) { element.kendoDropDownList({ dataTextField: "Text", dataValueField: "Value", dataSource: { data: categoryOptions…

Kendo UI Grid Custom Filterable

Kita dapat mengganti apa saja isi filterable (eq / contains / etc) dan bahasa yang digunakan pada Kendo Grid. Untuk memudahkan, kita bisa menyimpan variabel filterable pada webapp.js [code language=”javascript”] var customKendoGridFilter = { messages: { info: "Tampilkan yang memiliki nilai:", // sets the text on top of the filter menu filter: "Filter", // sets…

The specified type member ‘Date’ is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties

Fungsi komparasi Date pada Linq dapat menimbulkan error seperti tertulis di judul. Solusinya dengan menggunakan fungsi TruncateTime [code language=”csharp”] var eventsCustom = eventCustomRepository.FindAllEventsCustomByUniqueStudentReference(userDevice.UniqueStudentReference) .Where(x => DbFunctions.TruncateTime(x.DateTimeStart) == currentDate.Date); [/code] http://stackoverflow.com/questions/14601676/the-specified-type-member-date-is-not-supported-in-linq-to-entities-only-init

Pass Data using jQuery Trigger Event to a Change Eveng Handler

Waktu men-trigger event change untuk html element tertentu, kita dapat mem-pass data. Contoh kode sbb [code language=”javascript”] $(‘.change_main_image’).on(‘click’, function() { $(‘input[name=photo].change_uploader’).trigger(‘change’, [{somedata:true}]); }); $(‘input[name=photo].change_uploader’).on(‘change’, function (e, data) { alert(data.somedata); //canvas resize and upload script }); [/code] http://stackoverflow.com/questions/13506209/pass-data-using-jquery-trigger-event-to-a-change-event-handler

Kendo Window Attach Event to HTML Element Inside Template

Untuk kasus Kendo Window dengan content dari template, misalnya [code language=”javascript”] <script id="notifyHRTemplate" type="text/x-kendo-template"> <p> <a href="javascript:" class="btn btn-primary send-notification">Send Notification to HR</a> <a href="javascript:" class="btn btn-default close-window">Cancel</a> </p> <table class="table table-bordered"> # for (var i = 0; i < data.length; i++) { # <tr> <td>#= data[i].Name #</td> <td>#= data[i].Status #</td> </tr> # } #…