Sunday, September 7, 2014

DataTables TypeError: sGroup.toLowerCase is not a function

I have two (2) different tables which I dynamically populate with data once user clicked a button submitting an ajax request to server.

The 1st table consist of 4 columns having the below table structure:

  1. Column 1: Container ID (VARCHAR)
  2. Column 2: Pallet ID (VARCHAR)
  3. Column 3: Quantity (INT)
  4. Column 4: Action (VARCHAR)
The 2nd table consist of 5 columns having the below table structure:

  1. Column 1: Box Number (INT)
  2. Column 2: Container ID (VARCHAR)
  3. Column 3: Pallet ID (VARCHAR)
  4. Column 4: Quantity (INT)
  5. Column 5: Action (VARCHAR)

The only difference is that the 2nd table should be able to show Box Number on the first column.

I tried to apply row grouping on the 1st table for better data representation after populating the table using the following code:

$.each(result.data,function(i,e){
     MyTable.fnAddData([e.ContainerID,e.PalletID,e.Quantity,'Action'],0,0);
}

The 1st table is perfectly working. So the next thing that I did is to replicate the code for the 2nd table and just added the first column (Box Number).

$.each(result.data,function(i,e){
     MyTable.fnAddData([e.Boxnumber,e.ContainerID,e.PalletID,e.Quantity,'Action'],0,0);
}


With several attempts it shows an error saying:
  • TypeError: sGroup.toLowerCase is not a function
I tried to debug my code and read all the lines if I have missed anything but still having issues. So the next thing that I did is to search for the toLowerCase function on the plugin and I found the below code:

function _fnGetCleanedGroup(sGroup) {
     if (sGroup === "") return "-";
     return sGroup.toLowerCase().replace(/[^a-zA-Z0-9\u0080-\uFFFF]+/g, "-"); //fix for unicode characters (Issue 23)
     //return sGroup.toLowerCase().replace(/\W+/g, "-"); //Fix provided by bmathews (Issue 7)
}

BTW, I'm using the row grouping version 1.2.9 by Jovan Popovic. Can be downloaded here.

I modify the function and it worked! However, there comes another issue in grouping as it doesn't group the record correctly. So I reverted the code and tried another solution.

Looking on the sample data, I have noticed that the row grouping works well with string and I only encounter issues whenever the first column contains an integer (number). So I've come up with the solution as shown below:

$.each(result.data,function(i,e){
     MyTable.fnAddData([e.Boxnumber.toString(),e.ContainerID,e.PalletID,e.Quantity,'Action'],0,0);
}

I've added toString() function on the Box Number field so that the row grouping plugin would identify the data as string.

I think this would be one of the quick fix solution that I can share with you guys. Please do share your thoughts and suggestions as well so that I can improve my mine too :)


Monday, May 26, 2014

PHP IIS Setup Issue: 401.3 Unauthorized Due to ACL on Resource

I have been encountering this issue every time I manually setup different versions of PHP (isapi) on IIS 6.
Let's assume that you already setup the following:

  • Add PHP path on Environment Variables
  • Add PHP web extension service on IIS
  • Add PHP mapping on the application configuration of a website property.

After the above configurations, there comes now the permission issues.
Whenever I test a simple PHP code it always prompts me with the following Error message:

HTTP Error 401.3 - Unauthorized: Access is denied due to an ACL set on the requested resource.

So here's a quick fix:

Step 1. Go to PHP folder
Step 2. Right Click > Properties
Step 3. Select Security Tab
Step 4. Add "Users" under "Group or user names:"  with Read & Execute, List Folder Contents (optional), & Read.
Step 5. Click Ok

Tada!!!!

I'm still testing some scenarios, hope this quick fix can help you guys.
Please share your thoughts.


Friday, March 7, 2014

Enable cUrl in PHP 5.2.14

1. Download zlib.dll version 1.2.5 (recommended) or version 1.2.3
- you can download at http://www.zlib.net/ or here.
2. Go to your PHP folder and look for zlib.dll and rename it to zlib-old.dll
3. Copy and paste the downloaded zlib.dll into PHP folder
4. Search and backup php.ini file from the PHP folder.
5. Open php.ini file; find 'php_curl.dll' and enable cUrl extension by removing the semicolon from the beginning of the line and then save.
6. Once saved, you may need to reload PHP
- if you are using IIS 6 then you can follow the steps here.

Wednesday, February 19, 2014

How to reload php.ini in Windows IIS 6

This has been an issue since day 1 on our server which is using IIS 6.
After several changes in php.ini file, I've tried to check phpinfo() and found out that the changes that I've made did not reflect. So I've tried a lot of things such as restarting the website etc... but only 1 simple solution resolves the problem.
The simplest solution is to recycle the application pool where the website resides.
But always take note that it is highly advisable to do this during maintenance period or when no one is using the application to avoid interruption.



Thursday, September 27, 2012

WP NextGEN Gallery Permission Problem in IIS7

I was trying to play around with NextGEN Gallery earlier and I noticed that whenever I upload photos into my gallery, the images doesn't seem to show on my website and the files uploaded is not accessible as shown on the screenshot below:



FYI, I am using IIS7 with PHP version 5.2.9 on my localhost.

After a couple of googling - I figured out a simple solution to make my gallery work.
Below are the steps I've done.

1. Open IIS7

2.  Scroll down to the website you are working on and then go to the gallery default folder of WP NextGen. Right click on it and select Edit Permissions...

3. The gallery properties will pop out on your screen and then you need to do the following steps:

- go to Security tab
- Click Edit, another pop up window will show (Permission for gallery)
- Select CREATOR OWNER
- Tick Full control on the permissions
- Click Apply

After completing all the steps above you may now see the images on the folder itself and your gallery will now work on your website.

Hope it works with you guys...