Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Control 1

Status
Not open for further replies.

btgroup

MIS
Jan 21, 2003
64
US
Hi,

I am looking for a javascript-based grid control that allows sorting based on columns, an onclick event when a row is selected, and (most importantly) the ability to begin typing in a row and automatically jump down the sorted list of records as you type.

Has anyone come across this or written this before? Thanks in advance!!
 
Sorting a table is in faq216-3599.

I'm not sure what you want when you say "an onclick event when a row is selected"

To make a new row, you will need to use input boxes (like a form) and submit them - not too hard...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Thanks. That takes care of requirement one. By onclick event I mean that when I click a row, I can trigger off an event such as submit a form. I'm sure I can figure that one out myself. The most important part of my question is the last part.

There must be a way to begin typing in a column and automatically jump down the list as you go. I could use a select list, but you can only jump based on the first character. So when you have Alabama, Alaska, and Arkansas in the same list, you can't jump directly to Arkansas by typing AR.
 
So you want an input box for each column that accepts the users input and jumps to that row of the table? I thought you were saying that you want the user to be able to add rows to the table....

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Correct. I don't need to add rows of any kind. Maybe this will be a better example. If my table has two columns, one for city name and the other for state. I would like to sort on the city name, which you already showed me...thanks. Then, I would like to pick the first city in the column and begin typing. As I type, I will be moved down the list. I don't want to be restricted to the first letter of the city though. So when I type BO, I will be sent directly to the row that has Boston (not Baltimore or Orlando). Thanks again!
 
I'm gone for the weekend - remind me on Monday if you need for me to get you that code - not too difficult...

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Well, it's Monday and I could definitely still use that code! Thanks for all your help!
 
<script>
function findNext(){

window.stateList = document.getElementById(&quot;selField&quot;)
findVal = document.getElementById(&quot;picker&quot;).value
for (x=0; x<stateList.options.length; x++){
if (stateList.options[x].text.substr(0,findVal.length).toLowerCase() == findVal.toLowerCase()){
stateList.selectedIndex = x
return
}
}
}
</script>

<input id=&quot;picker&quot; onKeyUp=&quot;findNext()&quot;>
<select id=&quot;selField&quot; size=20>
<option value=&quot;AK&quot; >Alaska
<option value=&quot;AL&quot; >Alabama
<option value=&quot;AR&quot; >Arkansas
<option value=&quot;AZ&quot; >Arizona
<option value=&quot;CA&quot; >California
<option value=&quot;CO&quot; >Colorado
<option value=&quot;CT&quot; >Connecticutt
<option value=&quot;DC&quot; >District of Columbia
<option value=&quot;DE&quot; >Delaware
<option value=&quot;FL&quot; >Floridd
<option value=&quot;GA&quot; >Georgia
<option value=&quot;HI&quot; >Hawai
<option value=&quot;IA&quot; >Iowa
<option value=&quot;ID&quot; >Idaho
<option value=&quot;IL&quot; >Illinois
<option value=&quot;IN&quot; >Indianna
<option value=&quot;KS&quot; >Kansas
<option value=&quot;KY&quot; >Kentucky
<option value=&quot;LA&quot; >Louisianna
<option value=&quot;MA&quot; >Massachussets
<option value=&quot;MD&quot; >Maryland
<option value=&quot;ME&quot; >Maine
<option value=&quot;MI&quot; >Michigan
<option value=&quot;MN&quot; >Minnessota
<option value=&quot;MO&quot; >Mousouri
<option value=&quot;MS&quot; >Missippi
<option value=&quot;MT&quot; >Montana
</select>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

fart.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top