Pages

Search

Wednesday, February 1, 2012

Freeze Row and Header of a HTML Table

This post helps to freeze the header row and first column of a HTML table using java script.

Below is the sample html page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<style type="text/css">
/* Div container to wrap the datagrid */
div#div-datagrid
{
height: 200px;
overflow: auto;
}
</style>
<script type="text/javascript">
function freeze() {
freezeRow1Col1('tbl', 'tblRow1Col1', 'tr_header');
freezeColumnHeader('tbl', 'tblColumnHeader', 'tr_header');
freezeRowHeader('tbl', 'tblRowHeader', 'tr_header');

}
function freezeRow1Col1(srctbl, desttbl, trhdrid) {
var tbl1 = document.getElementById(srctbl);
var tbh1 = document.getElementById(desttbl);
var tr1 = document.getElementById(trhdrid);
var pr = tbl1.parentNode;
var newTr = document.createElement("tr");
var newTd = document.createElement("td");
if (tr1 == null) return;
var td = tr1.childNodes(0);
for (j = 0; j < td.attributes.length; j++)
if (td.attributes(j).value != "null" && td.attributes(j).value != "") {
if (td.attributes(j).name.toUpperCase() == "NOWRAP" || td.attributes(j).value.toUpperCase() == "FALSE")
continue;
newTd.setAttribute(td.attributes(j).name, td.attributes(j).value);
newTd.width = td.style.width;
newTd.height = (td.clientHeight - 2) + 'px';
newTd.innerHTML = td.innerHTML;
}
newTr.appendChild(newTd);
tblRow1Col1.childNodes(0).appendChild(newTr);
td.parentNode.removeChild(td);
}
function freezeRowHeader(srctbl, desttbl, trhdrid) {
var tbl1 = document.getElementById(srctbl);
var tbh1 = document.getElementById(desttbl);
var tr1 = document.getElementById(trhdrid);
tbh1.parentNode.style.width = tbl1.parentNode.clientWidth + 'px';
if (tr1==null)return;
var newTr = document.createElement("tr");
for (i = 0; i < tr1.childNodes.length; i++) {
var newTd = document.createElement("td");
var td = tr1.childNodes(i);
for (j = 0; j < td.attributes.length; j++)
if (td.attributes(j).value != "null" && td.attributes(j).value != "") {
if (td.attributes(j).name.toUpperCase() == "NOWRAP" || td.attributes(j).value.toUpperCase() == "FALSE")
continue;
newTd.setAttribute(td.attributes(j).name, td.attributes(j).value);
}
newTd.style.width = td.style.width;
newTd.innerHTML = td.innerHTML;
newTr.appendChild(newTd);
}
tbh1.childNodes(0).appendChild(newTr);
tr1.parentNode.removeChild(tr1);
}

function freezeColumnHeader(srctbl, desttbl, trhdrid) {
var tbl1 = document.getElementById(srctbl);
var tbh1 = document.getElementById(desttbl);
var pr = tbl1.parentNode;
var trs = tbl1.getElementsByTagName("tr");
for (i = 0; i < trs.length; i++) {
if (trs[i].id == trhdrid)
continue;
var newTr = document.createElement("tr");
var newTd = document.createElement("td");
var td = trs[i].getElementsByTagName("td")[0];
for (j = 0; j < td.attributes.length; j++)
if (td.attributes(j).value != "null" && td.attributes(j).value != "") {
if (td.attributes(j).name.toUpperCase() == "NOWRAP" || td.attributes(j).value.toUpperCase() == "FALSE")
continue;
newTd.setAttribute(td.attributes(j).name, td.attributes(j).value);
}
newTd.style.width = td.style.width;
newTd.innerHTML = td.innerHTML;
newTr.appendChild(newTd);
tbh1.childNodes(0).appendChild(newTr);
td.parentNode.removeChild(td);
tbh1.parentNode.style.height = tbl1.parentNode.clientHeight + 'px';
}
}
function rowHeaderScroll(obj) {
document.getElementById('div1').scrollLeft = obj.scrollLeft;
document.getElementById('div1').scrollTop = obj.scrollTop;
document.getElementById('div2').scrollLeft = obj.scrollLeft;
document.getElementById('div2').scrollTop = obj.scrollTop;
}
</script>
</head>
<body>
<form id="form1" runat="server">

<input type="button" name="btnFreeze" value="Freeze" onclick="freeze();" />
<table>
<tr>
<td>
<div id="div3" style="overflow: hidden;">

<table id="tblRow1Col1" border="1">
</table>
</div>
</td>
<td>
<div id="div1" style="overflow: hidden;" >

<table id="tblRowHeader" border="1" style="table-layout: fixed;" >
</table>
</div>
</td>
</tr>
<tr>
<td style="vertical-align: top">
<div id="div2" style="overflow: hidden">

<table id="tblColumnHeader" border="1">
</table>
</div>
</td>
<td>
<!--Note width specified in this below tag (800px) is used while calculating. changing this value will reflect in UI -->

<div id="div-datagrid" onscroll="rowHeaderScroll(this);" style="width:400px;">

<table id="tbl" border="1" style="table-layout: fixed;">
<tr id="tr_header">
<td style="width:100px">
Row1 Col1
</td>
<td style="width:100px">
Header 1
</td>
<td style="width:100px">
Header 2
</td>
<td style="width:100px">
Header 3
</td>
<td style="width:75px">
Header 4
</td>
<td style="width:75px">
Header 5
</td>
<td style="width:75px">
Header 6
</td>
<td style="width:75px">
Header 7
</td>
<td style="width:75px">
Header 8
</td>
</tr>
<tr>
<td style="width:100px">
Rec 1
</td>
<td style="width:100px">
Last Name
</td>
<td style="width:100px">
Address 1
</td>
<td style="width:100px">
Address 2
</td>
<td style="width:75px">
City
</td>
<td style="width:75px">
State
</td>
<td style="width:75px">
Zip Code
</td>
<td style="width:75px">
Phone
</td>
<td style="width:75px">
Email
</td>
</tr>
<tr>
<td >
Rec 2
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
<tr>
<td >
Rec 3
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
<tr>
<td >
Rec 4
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
<tr>
<td >
Rec 5
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
<tr>
<td >
Rec 6
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
<tr>
<td >
Rec 7
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
<tr>
<td >
Rec 8
</td>
<td >
Last Name
</td>
<td >
Address 1
</td>
<td >
Address 2
</td>
<td >
City
</td>
<td >
State
</td>
<td >
Zip Code
</td>
<td >
Phone
</td>
<td >
Email
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>






Row1 Col1 Header 1 Header 2 Header 3 Header 4 Header 5 Header 6 Header 7 Header 8
Rec 1 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 2 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 3 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 4 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 5 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 6 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 7 Last Name Address 1 Address 2 City State Zip Code Phone Email
Rec 8 Last Name Address 1 Address 2 City State Zip Code Phone Email

Friday, January 20, 2012

Google Sky Map for BlackBerry Playbook

Hello,

       Now you use the Google Sky Map into BlackBerry Playbook.

Google Sky Map - Download

Note :- You need the Updated OS 2.0 into your Playbook.



Monday, January 9, 2012

Browser Close Event - Javascript

Below is the sample html + java script source which helps to understand regarding how to fire the browser close event.
Beside below way of handling there is an another way. We can use use the body unload event and then in the unload event we will check the cursor position if it is near to window close button which mean user has tried to click on close button.
But this will not work if user says Alt+F4 or closes from task bar directly.

Scenario, like say if app should update database as logged out when user closes the browser.
This can be handled by calling a web page using XmlHttp request in the below "WindowClose" function.


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" language="javascript">

function WindowClose(event) {
event = event || window.event;

var confirmClose = "This is to fire the close event of browser";

if (event) {
event.returnValue = confirmClose;
}
return confirmClose;
}
window.onbeforeunload = WindowClose;
</script>
</head>
<body>
<form id="form1" runat="server">
<div>

</div>
</form>
</body>
</html>

After running the above ones and while trying to close the browser, dialog appears as per below screen shot.

The same applies for Firefox and IE Browser

Saturday, January 7, 2012

LinkedIn App for BlackBerry Playbook

Hello,

        Every buddy,Now you use as a App of LinkedIn into BlackBerry Playbook.So simple to download this bar file for Apps.

     Linked In Apps

 Enjoy it.

Friday, January 6, 2012

How the install .apk file into BlackBerry Playbook?

Hello,

    Every body today i got one solution about install .apk file into BlackBerry Playbook .Here i given you some step so follow it .


   Right now this step for beta Os 2.0.

Step : 1 -  First Register your playbook devices for Os 2.0 beta into below Link

             https://bdsc.webapps.blackberry.com/android/beta/bbtablet20/register/

     Note :- Make sure you upgrade your Playbook Os into 24 hr another you register Second time.

Step : 2 - Now you repackaging apk file into bar file.So follow the below link.In there some instruction given you               so follow those instruction.

              https://bdsc.webapps.blackberry.com/android/tool/

Step : 3 - This all step follow then install Android SDK and also install blackberry Playbook SDK.

Step : 4 - After install all you connect your device to Computer and then on the development mode from the devices at that time you got one IP so this ip use into install .bar file into Devices.

Step : 5 - Check this URL for install app to Playbook.

              http://supportforums.blackberry.com/t5/Tablet-OS-SDK-for-Adobe-AIR/How-the-install-Application-in-the-        BlackBerry-Playbook-Devices/m-p/1042923


Saturday, December 17, 2011

How to Install Simulator and Cod File in BlackBerry?


Downloading and Installing the BlackBerry Simulator
First, you’ll need to download and install the BlackBerry Simulator.You download from this URL.   Head over to the download page (link below), select the version of BlackBerry OS you want to try, and click Next.  We’re going to select v6.0.0, which is the latest version that will ship on the BlackBerry Torch.
image
You’ll need to register for the download, so enter your name and other info.
When you’re done, confirm that your information is correct, select whether or not you want to receive emails from RIM or BlackBerry, and click Next.
Agree to the license, and click Next.
Finally, click the Download link to download the simulator software.
Once the download is finished, run the installer.  Your computer may need to install some extra dependencies, so simply click Next to continue and install them automatically.

Once the prerequisites are installed, you’ll see the standard BlackBerry Simulator installer; click Next and setup as normal.
Once it’s installed, you’ll be ready to run your new virtual BlackBerry device from the start menu.
Using the BlackBerry Simulator
When you first run the Simulator, you may need to add an exception for it to your Firewall.  Windows Firewall will ask you to allow it to access your home networks, so just click Allow Access to let it have access to the internet.
You’ll also be prompted by the simulator with info about using the virtual touch screen on the simulator.
Now you’ll see a virtual BlackBerry on your desktop, booting the latest version of BlackBerry OS.
The simulator may be larger than your screen, so you may have to scroll down to see all of the virtual device.  You can change the zoom on the device from the View menu if you’d like.
Here’s the simulator at 50% zoom, so now we can see it all at once.
Install Apps Manually
If you have a BlackBerry app you’ve downloaded directly from the internet, you can install it in the emulator as well.  Click Load BlackBerry Application in the File menu to open the application.

Select the *.cod file you’ve downloaded in the Explorer window that opens.

Monday, December 12, 2011

How to install additional languages on your BlackBerry smartphone?


To install another language to your BlackBerry smartphone, you will need BlackBerry® Desktop Software installed on your PC. From the computer with your desktop software installed, download and install the software bundle that contains the language that you wish to add to your device. Once the software bundle has been installed, the language bundles that are available for your device will depend on the wireless service provider.

How to install and configure additional language packs on a BlackBerry smartphone

  1. From the BlackBerry Desktop Software website, download the BlackBerry® Device Software for the BlackBerry smartphone that includes the language pack you want. For example, BlackBerry Device Software v5.0.0.1014 (All Languages – East Asia languages included)
  2. Open BlackBerry Desktop Manager.
  3. Select the application loader tool.
  4. Open Add/Remove Programs. At this point, BlackBerry Desktop Manager will confirm if the installed version of BlackBerry Device Software version is specific to the wireless service provider that the BlackBerry smartphone was purchased from.
  5. From the Device Application Select screen, locate East Asian Language and Input Support.
  6. Select the language you want to install.
  7. Click Next. The installation will begin.
Once the BlackBerry Device Software is installed on the BlackBerry smartphone, complete the following:
  1. Go to Options.
  2. Under Input Language, select the language that was installed.
  3. Save your changes.
  4. Compose an email message to test the input language.

Note :- For more information on installing BlackBerry Desktop Software, see How to install the BlackBerry Desktop Software for Microsoft Windows.