Login Register

implementation of get for expandable tables

I have a crosstab that I am representing on my client with a grid. It seemed the most appropriate of the Dojo widgets at the time, but I have a bit of an issue.

I have followed the expandable grid example in the test and with some modifications everything is starting to hang together, but I am having an issue with the contents of the expanded row.

It would seem that this value is fetched lazily when the row is expanded. The get method I have defined is invoked when I expand the row. Thats all good, but I want the contents of this expanded cell to be an HTML fragment.

OK so I REALLY do not want to build an HTML fragment on the client (thats just nasty), I want to fetch the contents from my server.

So now I want to make a synchronous call to the server. My problem is that all the Dojo IO utilities are asynchronous and the newly expanded cell is not (seemingly) accessible in the context of the function to get the new value.

My question is how can I bind a server call to the cell during the get function?

I would really like to do something like this...

function getExpandedCellValue(inRowIndex) 
{
    return getContentForCell(inRowIndex);
}

Where getContentForCell is a synchronous server call.

Even better would be something like this...

function getExpandedCellValue(inRowIndex) 
{
    loadCellContent(inRowIndex);
    return 'Loading';
}

where loadCellContent makes an asynchronous call and sets the contents of the cell to an HTML fragment fetched from the server.

It so nearly works I can taste it.

Thanks In Advance
Paul B.