PDA

View Full Version : Programatically getting the values of cells in a gridPanel column



stedav
18 Nov 2009, 2:17 AM
Hi,

I have searched extensively the forums here, and read the threads. In addition I have referred to the API for help, yet none of these have really yielded the answer I am looking for. Thus, I will attempt to put my issue to the community in its own thread.

I have a gridPanel which displays a range of information taken from a database and populated from JSP generated JSON. I have a number of columns in my grid which display certain information. One column describes a certain status of a row. What I wish to do is to programatically (through a button handler function) take the values from that column based on what status (the value) they contain. I do not wish to select all the cells in that column, only the ones of a certain status.

I would appreciate that the answer doesn't simply refer me to the API, nor the FAQ. In fact, the FAQ contrary to what several threads have suggested, does not cover this issue directly nor in a round about way. Referring me to another thread is certainly fine, though I have not yet found a thread similar to this issue.

Lastly, as I have mentioned above, I wish to do this progamatically through a function called from a button handler, NOT from an individual a cell click event, or listener. As the data in the grid is returned from a search with time-based parameters (calendar field and time field) the function must pick up the current visible data on the grid / current state of the JSON store. Again based on a particular value in a column.

If you feel you need to ask for code, I cannot give you any, as as you would have read, I am trying to create the code to address this particular requirement, and its not an issue as of yet, just a difficulty in how to implement the requirement.

in brief: I wish to select particular cells in a gridPanel column based on their value.


I look forward to any constructive answers or suggestions you may have

Thanking you kindly

:-/

Animal
18 Nov 2009, 2:19 AM
A GridPanel is, (as you know, because you created the GridPanel) backed by a Store of Records.

That's where the data is.

How can you have missed the API docs for Store?

stedav
18 Nov 2009, 2:24 AM
A GridPanel is, (as you know, because you created the GridPanel) backed by a Store of Records.

That's where the data is.

How can you have missed the API docs for Store?

Hello Animal,

No I certainly have not missed the API docs for the Store, I am aware particularly of the JSON store, as this is what I have used regularly.

Is there a particular item in there you are thinking of that may address my requirement somewhat, in your reply? If so, would it be possible for you to point me in the right direction, or am am I to understand, this as a reminder only?

Animal
18 Nov 2009, 2:42 AM
Fields in a Record. That's what you want. Why think of the grid?

You want data? Go to the data.

stedav
18 Nov 2009, 3:03 AM
Fields in a Record. That's what you want. Why think of the grid?
You want data? Go to the data.
No, disrespect intended Animal, your help is greatly appreciated, but could you be more specific, this reply is slightly ambiguous?

I am now, on your advice, looking at the Store API as my JSON store is returned from the time-based query (I am assuming that it contains the data for the most recent search as it is reloaded as part of the search function). However, the nearest method i can see that may be of use is the collect(); So I initialized a test handler function as so:

('Status' is the dataIndex for the particular column)



var batchDownloadFailed = function()
{

var failures = new Array();
failures = Ext.getCmp('downloadQueueHistoryGrid').getStore().collect( 'Status', false, true ));

console.log(failures)

}
However, firebug is simply returning an empty array [] in its log.

Am I on the right track here or not?

Much appreciated

stedav
18 Nov 2009, 3:06 AM
Anaimal,

Much apologies, I realized my data index did not match the spelling in the collect function, it is now working ok.

Again, many thanks for your help

Steve