function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
OmerOmer 

Data Grid and Table

Hi

I wanted to know that is there any control through which we can show data in form of a grid in our applications? I am talking about a editable data grid like in MS Excel. Similarly, I like to make a table into which user can enter data (in different cells). How can this be done?

Thank you.
DevAngelDevAngel
Hi Omer,

The best way to implement a datagrid in an scontrol is to create a vb user control and use it as an embedded object in you s-control. You can certainly do something similar using dhtml and ajax but it takes a fair amount of work ( an existing framework would likely help out jackbe or something similar).
The_FoxThe_Fox
Hi DevAngel,

I think the best framework is openrico.org something like two js to embed and you are done

Regards
DevAngelDevAngel
Do you have a sample?
The_FoxThe_Fox
Hi Dave,

Not yet I am bit busy with the acquistion the company I work for has just made but I have some little things in the pipe

REgards
DevAngelDevAngel
Ok, so openrico is more that just two includes and you are done. The problem that I have with openrico is that it requires a crazy format for the data coming from the webservice (check out the tutorial and you will see). Also, it's a very basic grid. No hooks for editing a cell in the grid, or passing changes back to the service. No column resizing. Not really very dynamic as far as layout. You need to create to static tables, one for the header and another for the data. For the data, using rico out of the box, you need to put as many rows in the grid during design time as you want displayed. I "fixed" it so that you could put a single row in for shape and based on the pageSize (used in the paging/scrolling feature) it can now insert enough rows for later filling.

Openrico assumes that you have control over both what is being returned from the server as well as the client side stuff. I had to override 4 or 5 functions so that the data could be retrieved via another javascript function (sforceClient.query) and parse the results differently. I'll blog and post a sample, (sorting doesn't work) but I think this is not the right framework.

I'll continue to look for a better grid for use with the toolkit.
The_FoxThe_Fox
Ok Dave,

Thanks to have had a look at openrico.

BTW Do you think is it possible to get acces to the javascript event manager of salesforce.com. I would like to make a kind of ORg Chart with drag and Drop without the plugin from Dream Factory software and it will be cool to be able to make some drag and drops without havin to code all the event manager

REgards
DevAngelDevAngel
There are very few events in the current version of the toolkit and the ones there are deal primarily with diagnostics. The toolkit is first and foremost a javascript client for the api. This means that there is no dhtml framework for easily creating dhtml widgets such as you suggest. I did notice that the openrico stuff has some support for drag and drop. The trick is to "bind" each bean to it's chart element. This should be pretty simple since you can just create a property which is a reference to the bean on the fly.

So the first task is to query the data and construct a linked list of the dyanbeans. I've done this for our call scripting demo and it's quite simple. If you are trying to map the role hierarchy, then you will want to query for all roles using no criteria. Just gobble up all the data async and while that data is being retrieved and parsed, punch up a progress indicator.

Select Id, Name, ParentRoleId from UserRole.

With these records, you can now create a linked list of dynabeans setting childBeans, nextSibling, prevSibling, parentBean, hasChildren etc. What ever you need to keep the list ordered. Then, you walk your list and create ui elements. In the sample I'm creating a bunch of divs. I assume there is a library out there that can make a div drag and droppable, so this might be useful. For each div that is created, you give the div a new bean property that contains a reference to the bean it's displaying. Likewise you can give the bean a reciprocal div property so that you can get the div that is displaying it from the bean itself. The sample I'm including shows how to attach events to the html elements.

Hope this helps. Let me know how it goes.

Save the attachment and change the extension to html to run.

Dave.
The_FoxThe_Fox
He Dave

Thanks a zillion time for this

Regards
cpo87cpo87
Has anyone figured out how to do this.  I would like to display account information in a grid with the cells being editable.  I would also need to be able to report upon the values populated.

Any help is greatly appreciated.
mmitchellmmitchell
Has anyone figured out how to do this yet?  I'm supposed to figure it out by tomorrow... I figured this was such a standard component that someone would have cracked it by now.