:: Forum >>

Assigning Datasource dynamically

Dear Alex

I have gone through the Support Forum and tried even the help in the form.

Kindly give me clear and straign answer for the following question. If the answer for my question is YES then please post complete example or simply say NO this feature is not supported.

I am not a JavaScript Pro. I am trying to use Microsoft Remote Scripting to get data from from database server dynamically.

I have a list of regions and I have to display regions data for the selected region 50 rows at a time. The columns for every region are different.

My only requirement is to change the GRID source (columns and data) dynamically.

MyHeader = GetHeader(selected region);
MyData = GetData(selected region);
MyGrid.Refresh() or anything like MyGrid.ReloadData() etc.

I HAVE SEEN Sudhaker Raj EXAMPLE AND WORKS PERFECTLY. HOWEVER, I WANT TO DO IT WITH THE BASIC GRID EXAMPLE COMES WITH THE GRID WIDGET; I.E., WITH THE STANDARD GRID WITHOUT ADDITIONAL CHANGES.

thanks in advance Alex

regards

Please give me precise
Quadri
Thursday, May 26, 2005
Assuming that you have a grid named myGrid and your JavaScript data array for that grid is myGridtempData then once someone clicks on something on your page and you send a signal to your server, your server can send back Javascript (assuming that you are using a dynamically created SCRIPT DOM Element as the transport portal) that looks like:

var myGridtempData = [
["M000273","A","COMPLETE"," ","04%2F05%2F2004%206%3A52%3A52%20AM","IDP"]
]; // the new data to replace the old data
myGrid.setDataProperty("text", function(i, j){return unescape(myGridtempData[i][j])}); // make sure the grid gets data from this Array
myGrid.setRowCount(1); // the new dataset has only one row
myGrid.setProperty("selection/index", 0); // set the selected row to the first row
myGrid.refresh(); // refresh the grid display


This is how I dynamically update grid data without re-loading the entire page. As for the rest of the code needed to do this, you are going to have to write that yourself as most of it will reside on your server.
Jim Hunter
Friday, May 27, 2005
Dear Jim,

Thank you for your response. I dont know about the people who know JavaScript well, but, for me you solved a big problem.

thanks again for your help

ALEX: I am extremely sorry to ask the question this way. I was getting frustrated after searching the forum and not finding any solution to my problem. Your grid widget has inspired me to learn JavaScript.
THANKS FOR THE EXCELLENT COMPONENT.

Do you have any plans for serverside implementations for the GRID???
Quadri
Friday, May 27, 2005
You’re welcome. Actually, the technique that I use for changing the data in the grid via a call to my server is not something many people know how to do. I have spent over a year fine tuning my application (I don't have "web pages", I have a web application that runs in a browser). I have the added advantage that we are not using IIS or Apache or any other third party web server, we wrote it ourselves so we have 100% full control over every aspect of communications between the server and the web browser. So what we are doing would be much harder to do with third party web server, but not impossible.

I don't know about Alex's feelings on the subject, but I don't believe that a server side implementation of the grid would be practical. He would only be able to reduce the size of the JS file a tiny bit since most of the JS is about manipulating the data and resizing columns and sorting, etc. These are not functions that could reside solely on the server, they have to be on the client for speed. So in my opinion, it would not even be worth the time to try it as the ROI would not make sense.
Jim Hunter
Friday, May 27, 2005
Dear Jim,

By saying serverside implementations, I did not mean just keeping the grid.js on server. In fact, I am trying to find ways to make this client-side grid a real database-grid that can load data from server as many of the grid vendors doing today. And people should be able to use this grid from ASP, ASP.NET, JSP etc. What I like about Alex's grid is its very flexible and the concept is excellent.

I will spend some time to understand first how JavaScript works then understand the inner working of Alex grid widget. Then probably I'll look for how I can change this grid to a real DataGrid. When I say DataGrid it does not mean the data must be comming from a database server like Oracle or SQL server. I mean the datasource, that can be anything like DBMS data, Excel, CSV, or XML .....

I think Alex can increase his sales if his grid support these features.

I wish Alex good luck.
Quadri
Saturday, May 28, 2005
Quadri,
You have peaked my interest. Please point me in the direction of a competing grid component (even if it sucks) that allows the user to connect to a datasource. I would liket to see how they are doing it. I don't feel this is something that Alex needs to worry about. Any developer that is serious (and you must be if you are using Oracle) can write a harness around this grid to feed it data. That is what I have done. We get our data from Oracle and I simply wrote a few functions that I tied into the grid to dynamically alter the data. We have cascading grids where one grid sets the key field of another which sets the next etc.

Grids that were designed for ASP.NET are not going to work on Apache (without the appropriate extensions) and certainly not going to work as a client side only grid such as what Alex has. His grid will work in ASP and ASP.NET just as they do in PHP or DHTML, but you have to code the interface between them.

Creating a grid component for ASP.NET is actually a lot easier then creating one for JavaScript. But if you create one then it can only be used for ASP.NET. For me, I would not want to limit my buying audience. The current grid can be used by everyone, making it ASP.NET or ASP would actually reduce the number of potential buyers. I think Alex took the right road. I know that I looked at many grid solutions and my company purchased only this one. None of the others made sense. We had to create a product that would run on as many computers as possible, this was the answer.

I don't know how much work you have done with ASP.NET or ASP, but for me they are both way too slow for what I do. Two second page updates is not acceptable for my company. Currently, I can click on a row of one of my grids and the other ones are updated in less then 1/2 second. Yes, his grid is that fast!

But this is just my opinion, I could be wrong.
Jim Hunter
Wednesday, June 1, 2005

This topic is archived.


Back to support forum

Forum search