Archive for Code

Change ExtJs EditorGridPanel row color after edit

// May 19th, 2011 // 2 Comments » // Code, Featured

By adding an afteredit listener to your editor grid you’ll be able to change the row color on the fly, right after
the cell has been changed so users will be able to tell which records have been changed. I’ve added this instead of the little red tickbox since it is easier for the user to see and it just looks better.
Just in case this would conflict with the little red icon, I also went ahead and removed it with my custom.css file (shown below).

(more…)

How to remove trailing zeros from MySql decimal fields

// May 17th, 2011 // 2 Comments » // Code, Uncategorized

My quickest tutorial to date, simple mysql query to remove trailing zeros from decimal fields.
Initially our data looks like this:
(more…)

Open iReport jrxml from ExtJs as pdf

// May 17th, 2011 // 1 Comment » // Code, Featured

In this post I’ll show you how to create a report using iReport, uploading to your jasperserver running on tomcat and accessing the report from an ExtJS grid. In addition to Apache, MySql and ExtJS libraries (I’m assuming you already have those installed) you will need to get the following installed:

1. iReport (on your laptop/workstation)
2. tomcat (on your server)
3. jasperserver (on your server)

(more…)

Extjs Cascading (Dependent) Combo Boxes

// April 11th, 2011 // 10 Comments » // Code, Featured

This tutorial was written after one of my readers requested help with creating a dependent dropdown menu for continents, countries and states. I hope this helps everyone out there, who like myself, have struggled with this in the past.

First you’ll need to create the connect.php file, explained here.

Next create the 3 mysql/php/json files used for:
1. gathering data from mysql,
2. storing the data into a json array for each of the combo boxes you’ll be using (Continent, Country and State).

(Please adjust the paths to connect.php (mentioned above) and all other files used in this example
accordingly and create the required tables in mysql as needed)

Start by creating the continentQ.php file, to gather the continent data:
(more…)

Create Extjs PDF Report

// February 12th, 2011 // 12 Comments » // Code, Featured

I have been looking for ways to export MySQL data to pdf using ExtJS, and up to this day I haven’t been able to
find a simple solution. I finally came across a project called “PHPJasperXML”, which allows me to access MySQL data, export it to pdf from my ExtJS application, using php and without having to use any javascript.
Albeit, the report isn’t necessarily created by ExtJS, it is extremely easy to create the report and implement this on your ExtJS application.

**** Update May 17th 2011 ****
This is an alternate solution to PHPJasperXML, it uses jasperserver to store the report which can be accessed via its url and you can also use subreports and multiple parameters.

*****************************

(more…)

Array as ExtJS baseParams

// August 21st, 2010 // 4 Comments » // Code, Featured

In this tutorial I’ll walk you through using the results of an array as an ExtJS baseParams, with the help of php implode and php explode. ExtJS baseParams are parameters that can be passed with all requests, parameters are encoded as standard HTTP parameter using Ext.urlEncode. A typical basepaParams usage may look like e.g. baseParams: {id: ‘123′, foo: ‘bar’}, however, we’ll be using the results of an array as our baseParams instead of a single value. (more…)

How to Change Permissions Recursively on Linux

// August 14th, 2010 // No Comments » // Code, Featured

This is a quick one, how to change permissions recursively on directories or files. Say you want to change the permission on all directories under /home/username to 775 and all files to 664. All you need to do is issue the following commands: (more…)

How to Install Handbrake on Ubuntu 10.04 Lucid Lynx

// August 12th, 2010 // 9 Comments » // Code, Featured, Video

HandBrake is an open-source, GPL-licensed, multi-platform, multi-threaded video trans-coder, available for MacOS X, Linux and Windows. In this tutorial I’ll walk you through setting up the latest version of HandBrake on Ubuntu 10.04 Lucid Lynx, it is rather easy.
Unfortunately, however, as of Ubuntu 9.10 they no longer have their latest version of the installer available for Ubuntu on their website — “HandBrake 0.9.4 is no longer available due to compatibility issues with the newer version of gnome”. (more…)

Extract Single Table From mysqldump File

// August 4th, 2010 // No Comments » // Code, Featured

I wanted to restore a mysql table from a mysqldump file to another server, but I wanted to extract the information about this table only. One of the ways this can be accomplished is by using awk. This is the command I ran: (more…)

Submit ExtJS Incoming Put Data into MySQL With PHP

// July 29th, 2010 // 1 Comment » // Code, Featured

Recently I built another ExtJS form panel containing a few form fields and an editable datagrid, and I wanted to implement the search box I used on a previous application. In theory this would’ve been a pretty simple task, taking into account I’ve already built both a search capable grid and an editable grid (I’ll be posting a tutorial on this in the near future), however, it wasn’t so easy, but I got it done and I’ll show you how. (more…)