[CLOSED] GridPanel.getRowsValues() issues with dynamic generated columns

  1. #1

    [CLOSED] GridPanel.getRowsValues() issues with dynamic generated columns

    Hi,

    I found a possible issue on getRowsValues() function.

    If I have a gripanel and add some column in code behind then I submit from client all rows passing all rows data with getRowsValues(), but only the data belonging to original columns are passed.

    The origin of the problem is this line

        dataR = this.store.prepareRecord(dataR, records[i], config);
    since prepare records map all fields between dataR and records[i], but records[i].fields has only description of column created in markup.

    It is a bug? If not there is a workaround on it?

    Thank you, Stefano
    Last edited by Daniil; Feb 09, 2012 at 7:50 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please demonstrate how do you add columns?

    Do you add respective RecordField-s?
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi,

    Please demonstrate how do you add columns?

    Do you add respective RecordField-s?
    Hi,

    this is the snippet

                var stocks = Factory.LoadStocks();
    
                foreach (Stock stock in stocks)
                {
                    rowsStore.Reader[0].Fields.Add(new RecordField(stock.StockName));
    
                    Column col = new Column();
                    col.DataIndex = 
                        col.Header = stock.StockName;
                    col.Hidden = false;
                    col.ColumnID = stock.StockName + "ID";
                    col.Editor.Add(new NumberField());
    
                    grdProducts.ColumnModel.Columns.Add(col);
                }
                grdProducts.Reconfigure();
  4. #4
    The GridPanel's Reconfigure doesn't affect on Store.

    Please replace:
    rowsStore.Reader[0].Fields.Add(new RecordField(stock.StockName));
    with
    rowsStore.AddField(new RecordField(stock.StockName));
  5. #5
    Quote Originally Posted by Daniil View Post
    The GridPanel's Reconfigure doesn't affect on Store.

    Please replace:
    rowsStore.Reader[0].Fields.Add(new RecordField(stock.StockName));
    with
    rowsStore.AddField(new RecordField(stock.StockName));

    Exactly ;)

    It works perfectly! Thanks.

    Another question. In one the code on the example page I found this line:

    rowStore.ClearMeta();
    What does this is useful for?

    Stefano
  6. #6
    This is required if you change the properties of Store's Reader like Root or IDProperty.
  7. #7
    Ok thank you.

    Mark this thread as Solved

Similar Threads

  1. Auto generated columns
    By tsuria in forum 2.x Help
    Replies: 7
    Last Post: Feb 21, 2012, 8:16 AM
  2. [CLOSED] How to Specify only columns that we want when use getRowsValues()
    By eaglemobile in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 26, 2011, 9:48 AM
  3. Replies: 2
    Last Post: Nov 22, 2010, 3:16 PM
  4. [CLOSED] [1.0] Problem with Dynamic Columns in gridpanel
    By juane66 in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: May 24, 2010, 3:33 PM
  5. [CLOSED] GridPanel + Dynamic Columns + Count
    By Zarzand in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Jul 10, 2009, 4:46 PM

Tags for this Thread

Posting Permissions