[CLOSED] how to save GridPanel configuration to db after user changed it during runtime

  1. #1

    [CLOSED] how to save GridPanel configuration to db after user changed it during runtime

    More simply: I need to know (i have no idea) how to get in code behind the grid panel's width when it is resized by user or the same for the hidden value.


    just want to save gridpanel columns width and hidden value changed by the user during runtime and send them to database linked to the username who dit the job to reload them later.

    in behind code i call the function in example in a directevent of a button for saving data.
    There I access the values i need in the way you see ( g.ColumnModel.Columns[i]..... ) and I don't get the changed by user values but the original values.
    for instance, user changed the width of the first column from original 50 to 145 but in the codebehind i get still 50.

    What structure should i access or what should i do?
    Thanks in advance

    
            public static void saveConfigurationGridToDB (GridPanel g, string savegridname ) 
            {
                for (int i = 0; i < g.ColumnModel.Columns.Count(); i++)
                {
                    string sql = "insert into myDbGridConfig (language, user, object, id_progr, text, width, fhidden) values (";
                    sql += "'French','myUser','" + savegridname + "'," + i.ToString() + "'";
                    sql += g.ColumnModel.Columns[i].Text + "',";
                    sql += g.ColumnModel.Columns[i].Width.Value.ToString() + ",";
                    sql += g.ColumnModel.Columns[i].Hidden.Value.ToString()+")";
                }
            }
    Last edited by Daniil; Oct 19, 2012 at 3:58 PM. Reason: [CLOSED]
  2. #2
    Hi @tanky65,

    The GridPanel and its Columns widths are not submitted to server automatically.

    You should send them to a server manually. For example, via extra parameters of a DirectEvent or a DirectMethod.
  3. #3
    Quote Originally Posted by Daniil View Post
    Hi @tanky65,

    The GridPanel and its Columns widths are not submitted to server automatically.

    You should send them to a server manually. For example, via extra parameters of a DirectEvent or a DirectMethod.
    ah thanks, I should treat them via extraparams for example by passing GetState() of the gridpanel encoding and then decoding to get again the values.
    I'll try in this way.
    Thanks again
  4. #4
    Quote Originally Posted by tanky65 View Post
    ah thanks, I should treat them via extraparams for example by passing GetState() of the gridpanel encoding and then decoding to get again the values.
    I'll try in this way.
    Thanks again
    fyi, what I did is the following:

                    <DirectEvents>
                        <Click OnEvent="getGridConfig">
                            <ExtraParams>
                                <ext:Parameter Name="GConfig" Value="Ext.encode(App.GridPanel1.getState())" Mode="Raw" />
                            </ExtraParams>
                        </Click>
                    </DirectEvents>
    and in behind code

    
        protected void getGridConfig(object sender, DirectEventArgs e)
        {
            string config = e.ExtraParams["GConfig"];
    
            if (string.IsNullOrEmpty(config))
            {
                return;
            }
    
           // treat the string as XML structure and handle the content
        }
    thread can be closed
    Last edited by tanky65; Oct 19, 2012 at 5:51 PM. Reason: typing correction
  5. #5
    Good! Thank you for sharing. It can help someone on the forums in the future.

Similar Threads

  1. [CLOSED] Desktop - saving user configuration and restoring it after login
    By inteligencija in forum 2.x Legacy Premium Help
    Replies: 9
    Last Post: Jul 25, 2012, 2:19 PM
  2. Replies: 2
    Last Post: Apr 07, 2012, 6:40 AM
  3. Save user theme preference
    By rainwalker123 in forum 1.x Help
    Replies: 2
    Last Post: Nov 26, 2010, 6:39 PM
  4. Replies: 4
    Last Post: Sep 28, 2010, 4:09 PM
  5. [CLOSED] [1.0] Loading User Controls in runtime
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 16, 2010, 8:07 PM

Tags for this Thread

Posting Permissions