25 Jun 2013 10:53 AM #1
Trying to add computed column to Ext.grid.GridPanel
I am trying to add a computed column to a Ext.grid.GridPanel that has an Ext.data.JsonStore as its store and Ext.grid.Column columns that each has a dataIndex that uses one of the Ext.util.MixedCollection fields that belong to the Ext.data.JsonStore. The Ext.util.MixedCollection fields seem to be outputted as a result of a function that initializes a new Ext.data.Connection object that calls its "request" method to get the JSON encoded result of a MySQL query. I want the computed column to show the value of the result of a function that is more complex than that of the arithmetic addition of two columns as demonstrated in the following link:
Specifically, I want to make this column depend on another MySQL query that needs the other fields that are in the Ext.grid.GridPanel. Is it possible to do this, and if so, does the link shown above have the key to doing what I want to do? Thank you. I am using Ext JS 3.4.0.
25 Jun 2013 5:05 PM #2
To add another example
I am trying to do a similar thing to what is shown in the link below:
However, instead of doing an arithmetic multiplication of two fields, I want this thing to perform another MySQL query to calculate a result based on the values held in each row in the Ext.grid.GridPanel. Specifically, I want a query like "SELECT fieldname FROM tablename WHERE fieldname = 'value that the other column in the Ext.grid.GridPanel has' AND fieldname = 'value that the other column in the Ext.grid.GridPanel has' AND fieldname = 'value that the other column in the Ext.grid.GridPanel has'".
27 Jun 2013 11:48 AM #3
To really get a sense of what I am trying to do
Please forget about my earlier posts in this thread. I think the following is a really good link that shows my situation:
Please refer to the section of the page above: "Creating our Search Form". To be as clear as I possibly can be, I am trying to add the computed column to an existing Ext.grid.GridPanel whose columns are already filled with results such as what the "searchPresidents()" function echoes. This computed column needs to see whether any field of each row in the grid has a duplicate value compared to the corresponding field of all other rows. What I want to do is add this column that somehow performs another MySQL query based on the results of what "searchPresidents()" echoes, hypothetically. The reason for this is that the existing columns of the Ext.grid.GridPanel should stay intact with the information that it already has (via "searchPresidents()"). The best representation of what I am trying to do is do is the following:
SELECT column1, column2, column3 FROM sometable t1 WHERE EXISTS (SELECT column1, column2, column3 FROM sometable t2 WHERE t2.column1 = t1.column1 OR t2.column2 = t1.column2 OR t2.column3 = "t1.column3");