Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 JavaScript DataGrid

Author  Topic 

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-05 : 09:35:37
I ran across this datagrid today

http://www.activewidgets.com/grid/

built using JavaScript. I'm left wondering why a JavaScript datagrid would be better than a server-side datagrid. (It isn't obvious from anything mentioned on the website.)

I can imagine that the column sorts are quicker (avoiding a postback). This doesn't appeal to me, since my recordsets are too large to cache locally for sorting.

Is there any other benefit to a JavaScript based datagrid?

Sam

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-05 : 10:09:14
AJAX based record retrieving.
EDIT:
http://www.codeproject.com/Ajax/AjaxGrid.asp


Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-05 : 11:36:51
Avoiding a Round-trip to the server strikes me as a good thing (i.e. where there is no need for the server to get involved). On public facing sites, particularly where users may have dial-up, mobile phone connections, whatever, the gain in performance is significant, and it takes some load off the server. But obviously only where all the necessary data is already available at the client.

Plus the Ajax stuff that Spirit mentioned - with which some pretty cool, interactive, Widgets can be created

Kristen
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-05 : 11:45:50
the problem with ajax is it's inability to navigate different page states with previous and next buttons.

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-05 : 12:58:27
Can you expland on that a bit please Spirit?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-05 : 13:05:20
ok.. let's say i have a page:
testPage.asp
on it i have an AJAX powered paging datagrid.
i happily and merrily change the pages up and down, ajax works great, all is super.
but since this is JavaScript DOM manipulation there's really no change in page history
so there's nowhere to go since you're on the same page that hasn't been posted to server.

with postback stuff if you page you can use back button to go to page 3 if you're on page 4.
with callback you can't (yet)

will that be ok?

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-05 : 13:17:47
Anyone know of a FLASH datagrid
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-05 : 13:34:23
what's wrong with Macromedias?

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-05 : 14:30:17
quote:
Originally posted by spirit1

what's wrong with Macromedias?
I was kidding. Why would anyone want a FLASH datagrid? Datagrids not hard enough without rendering them in flash?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-05 : 14:36:48
i know. i was trying to be serious with no luck...

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-04-05 : 15:35:11
My 2¢:

My experience has forever cemented postback, viewstate, and datagrids as EVIL. Like Satan evil. Viewstate is pure evil. Oh, I already said that. Well, it bears repeating. I believed this the moment ASP.Net was released, all I saw was overhead, overhead, overhead. I was doing stuff similar to AJAX before .Net came out, so I didn't feel like I needed this stuff, and I have yet to see an app that uses viewstate and postback efficiently (i.e. it's actually usable over a dial-up connection)

I don't plan on converting anyone to my point of view, so if you're happy with viewstate and postback, that's fine. Don't waste your time trying to convince me though, you can't.

As far as AJAX not affecting browser history, while that's true, AJAX is also not a typical web app model anyway, so standard web features may/should not necessarily apply. I'm a 100% believer in not going back to the web server if you don't have to, and if you do, then AJAX calls are better IMHO than posting the entire page. The argument that AJAX doesn't maintain state is exactly the point, you don't HAVE to maintain state since you're not dumping the entire page. (Google Maps, for example) And unless you're sending back 10,000+ rows of data to the browser, it's still more efficient to sort on the client than to repeatedly call the server and have it sort the same data over and over again.

I don't want to sound like an AJAX evangelist (I don't even like the term) because I don't think it's the right tool for every job, but I do think a lot of people drank too much MS .Net Kool-Aid and don't even realize how cumbersome ASP.Net can be, especially when compared to AJAX methods. (n-Tier? DCOM? remember these?) That said, they've definitely improved a lot of that in .Net 2.0, so the arguments against it are not as great.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-05 : 15:41:10
Rob... How do you really feel ?
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-04-05 : 15:43:06
Trust me, that's toned down.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-05 : 15:49:19
I try to keep my ear to the grindstone on this topic. Here's my spilt milk:

Equivalent functions are sexier if they're done client-side. That said, if I had to bet my last dollar on which code was more reliable, I'd have to bet on client-side server-side solutions. I've tried many quickly-coded JavaScripts which won't work correctly cross-browser. I don't have the confidence to invest in JavaScript solutions which may behave differently (or break) in different browser engines.

Somebody stop me... !

I know some unnamed persons prefer client-side anytime. And I won't name them here, although the initials R. o. b. might make it easy to guess, but I have never been swayed that it's OK to dump a large dataset to the client-side and let the filtering / sorting occur there. It just doesn't make sense to me. I'm a big fan of server-side recordset paging.

There. I've said it. My name is Sam, and I have a server-side addiction.
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-04-05 : 16:11:50
the biggest advantage to server-side is the browser indepedance. It doesnt' matter what browser you have, whether it can run javascript, what DOM model it implements, what the user's settings are, etc. server-side controls just require HTML.
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-05 : 16:14:40
Worth noting: Put a server-side and client-side solution in front of a customer prospect...

Which would the customer prefer?
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-04-05 : 19:36:53
Like I said, it's not the best approach for everything. Neither is .Net.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-06 : 01:54:01
"all I saw was overhead, overhead, overhead"

No need to convert me, I was already right behind you!

Page Bloat = Bandwidth = $$$ too

"with postback stuff if you page you can use back button to go to page 3 if you're on page 4"

... which may well be out of date now. Or the user will press SAVE to re-save from that [history] page, mucking up a Save done from some other location where the data was more current.

Horses for courses, I think!

Kristen
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-06 : 04:52:51
interesting discussion.

I'm not an AJAX disbeliver trust me
i like ajax.

Any SOLID solution built in JavaScript IS prone to many of the client settings (cross-browser) stuff.
DCOM... ahhh... those were the days

IMHO the best solution is a mix of both.
Client side functionality must be such that if disabled does't break the app completly.

And yes... postbacking has been far too overhyped. Imagine a page with 7 comboboxes...
after each change there's a postback... arghh
And who said you have to put everything in viewstate?

Dial-up? that still exists??

Don't web server implement page compression with zip by default now?

Kristen, you're right of course but that was just an example

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-06 : 07:53:20
"Any SOLID solution built in JavaScript IS prone to many of the client settings (cross-browser) stuff"

Yup, that's definitely a bummer ...

"Dial-up? that still exists??"

We notice it mostly with people using mobile phones to connect their laptops or whatever to the internet. I used a site the other day where it spotted that I was using a crap connection and gave me extra-low-resolution pictures - with a "click to get better ones" option. It was rather clever, I thought!

"Don't web server implement page compression with zip by default now?"

Don't know for sure. Plenty of shared hosting has it turned off (to save CPU at the expense of bandwidth - which they then charge [or restrict] the punter for, of course!)

We pre-compress all our HTML, JavaScript and ASP type stuff - to reduce bandwidth and give any source-code-interpreter an easier time by not having to parse a bunch of spaces and comments - hell! I don't want to give the comments away to people snooping our source for free either!

Kristen
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-04-06 : 08:00:39
No one answered my question on client preferences. I'm pretty sure customers will prefer what's faster, and JavaScript usually wins that contest.

One take from this thread is that some people here are familiar with ajax. Has anyone found any cross-browser problems when ajax is used to render datagrids?
Go to Top of Page
    Next Page

- Advertisement -