PDA

View Full Version : [CLOSED]Issues displaying a grid


dlstrawn
04-13-2010, 12:29 PM
Here is my code: sorry about the formatting

var mainDPA0006RGrid = new Ext.grid.GridPanel({
id: 'mainDPA0006RGrid',
store: dsMainDPA0006RGrid,
stateful: true,
stripeRows: true,
columnLines: true,
columns: [
{header: '<b>Test</b>'},
{header: '<b>Container</b>',width: 125,sortable: true,dataIndex: 'AF01CNO'},
{header: '<b>Invoice</b>',width: 125,sortable: true,dataIndex: 'AF01INO'},
{header: '<b>Bill of Lading</b>',width: 125,sortable: true,dataIndex: 'AF01BL'},
{header: '<b>Carrier</b>',width: 125,sortable: true,dataIndex: 'AF01CARR'},
{header: '<b>Sail Date</b>',width: 100,sortable: true,dataIndex: 'AF01SAIL'},
{header: '<b>To Port</b>',width: 100,sortable: true,dataIndex: 'AF01CBPC'},
{header: '<b>ETA Port</b>',width: 100,sortable: true,dataIndex: 'AF01ETAP'},
{header: '<b>To Port</b>',width: 100,sortable: true,dataIndex: 'AF01RP'},
{header: '<b>ETA DC</b>',width: 100,sortable: true,dataIndex: 'AF01ETAD'}
//{header: '<b>Receiver</b>',hidden:true,width: 125,sortable: true,dataIndex: 'AF01RNO'}
],

notice the 1st header (test). if I comment this out the 2nd header does not show, so I have to leave it in there for the first header to show. Why?

My response string from firebug shows the following for the first returned row:
{"totalCount":25.00000,"autogrid":[{"AF01CNO":"MSKU4526410","AF01INO":"GB0296/10/C","AF01BL":"801807299","AF01CARR":"MAERSK LINE","AF01SAIL":0,"AF01CBPC":"1601","AF01ETAP":0,"AF01RP":"DL","AF01ETAD":20100406,"AF01RNO":1861}

the fields in my data store are as follows:
fields: ["AF01CNO","AF01INO","AF01BL","AF01CARR","AF01SAIL","AF01CBPC","AF01ETAP","AF01RP","AF01ETAD","AF01RNO"].

Any ideas as to why I am having this problem?

richard.milone
04-13-2010, 12:46 PM
It's probably because you have stateful set to true but do not give the columns id's. The state mechanism uses a component's id to remember the state. If you don't specify a specific id then they will get auto-assigned and you'll have unpredictable results. First try setting stateful to false and see if that fixes the problem. If is does then you can set it back to true but be sure to then add an id property to each column.

richard.milone
04-13-2010, 12:48 PM
By the way, surround your code with CODE tags and it will be formatted properly on the forum. When in Advanced editing mode look for the button with the # sign on it. If you highlight your code and then click that button it will put the CODE tags on.

sean.lanktree
04-13-2010, 01:06 PM
Clear your cache on your browser and try it again.

dlstrawn
04-14-2010, 08:34 AM
That makes sense, thanks for the help guys!

dlstrawn
04-14-2010, 10:13 AM
I am speaking in general, but when you are changing a custom program that Valence is running, is it sufficient to reload the page and clear the cache, to get the new program in use in the viewport? It seems that occasionally, I have had to restart the Valence HTTP instance to get a change in.

richard.milone
04-14-2010, 10:34 AM
In general you only need to close the tab of the program you have open and then re-launch the program from the navigation tree. That usually picks up the latest RPG program object and html/javascript. However, that are rare cases (you found one) where if you have a state cookie that's messes up you would need to clear your cache after fixing the program. Also if you design your Valence programs to call in external JavaScript those are usually cached until you restart your browser or clear the cache (this can be overridden by setting the scripts not to cache). If you're just getting started out with Valence though you're probably not at the point where you need to worry about that yet.

On the occasional times where you've had to restart the HTTP server your RPG program object probably went into QRPLOBJ after a recompile. This is rare, and I think caused by trying to launch the program at the same time as a compile is running. You can avoid an HTTP server restart by simply checking QRPLOBJ for your object and deleting it from there.

robert.swanson
04-14-2010, 10:52 AM
One more thing: If you're compiling programs in an active instance of Valence, be sure you have the "Development Instance" box checked in the Valence Settings program, as explained in section 3.4 of the Valence manual. This will help ensure you don't execute an old object in QRPLOBJ as well.

dlstrawn
04-14-2010, 11:56 AM
Thanks for the help guys.