[CLOSED] Razor- Grid Panel Editor Combobox

Page 1 of 4 123 ... LastLast
  1. #1

    [CLOSED] Razor- Grid Panel Editor Combobox

    When I am trying to add a parameter to a store, to get back data I just get an error, is this me or is it a bug ... code is below

    
    .Editor(
                                                                Html.X().ComboBox()
                                                                    .ValueField("SettlementAccountId")
                                                                    .DisplayField("Name")
                                                                    .Store(
                                                                    Html.X().Store()
                                                                    .ID("StoreSettlementAccountList")
                                                                    .AutoLoad(true)
                                                                    .Model(Html.X().Model()
                                                                    .Fields(
                                                                        new ModelField("SettlementAccountId", ModelFieldType.Int),
                                                                        new ModelField("Name", ModelFieldType.String)
                                                                            )
    
                                                                          )
                                                                     
                                                                    .Proxy(
                                                                    Html.X().AjaxProxy()
                                                                    .Url(Url.Action("GetSettlementAccountList"))
                                                                    .ActionMethods(actions =>
                                                                    {
                                                                        
                                                                        actions.Read = HttpMethod.POST;
                                                                    }
                                                                                   )
    
                                                                        .Reader(
                                                                        Html.X().JsonReader().Root("result")
                                                                               )
    
                                                                           )
                                                                    .Parameters( para = >
                                                                    {
                                                                        para.add(new Parameter("id", "record.get('OrderLinkId')", ParameterMode.Raw));
                                                                    }
                                                                        )

    P.S... Still no answer from any of the ext support team, I should be getting premium support. 3 mails no answer.
    Last edited by Daniil; Jan 25, 2013 at 2:57 PM. Reason: [CLOSED]
  2. #2
    Hi,

    If you want to get answer then please always include runable test case

    About your parameter value
    record.get('OrderLinkId')
    There is no 'record' reference when a store initiate load request. What 'record' do you mean?
  3. #3
    Hi Vladimir

    Thanks for replying, first can you get someone to sort my premium access, I've emailed now About 3 times and no answer. Now back to the code.

    This example is runnable if you add the code to a column model on a grid panel you should then see that i'am getting an error on the .parameter the msg in visual studio is about it not being a lambda delegate? I have taken this example of usage from another forum answer so assume it is the correct usage? But razor example a far fewer than web forms.

    I cannot post the full code from the application but the .editor block should be self contained.

    Quote Originally Posted by Vladimir View Post
    Hi,

    If you want to get answer then please always include runable test case

    About your parameter value
    record.get('OrderLinkId')
    There is no 'record' reference when a store initiate load request. What 'record' do you mean?
  4. #4
    I cannot post the full code from the application but the .editor block should be self contained.
    We don't need full code, just create simple runable test case reproduces the issue. We cannot use just part of the code, it is better if we just run your ready sample

    - need to use 'Add' method of 'para' collection instead 'add' (C# is case sensitive language)
    - you have to use StoreParameter instead Parameter
    - 'record' reference is absent, you will get javascript error
  5. #5
    First can you get someone to sort my premium access, I've emailed now About 3 times and no answer.
    I will notify our manager, if you purchased premium support then you should get email with SVN credentials. I will ask about you
  6. #6
    Ok so I have got "Parameter" to work a few silly typo's.

    But to the topic of this thread I am trying to pass a parameter from a cell on a row to a direct method and then using this in my SQL to return my dataset for the combobox.

    I can do this fine on a click event on a row I tried using .ExtraParams on the AjaxProxy but found threads saying this way not the way to do it and to use .Parameters instead, which does not give the result I am looking for.

    I am stuck, only want to pass a value from a cell on a selected row to get data for a combobox. For a test case code below to work with...

     @Html.X().ResourceManager()
     @(
      Html.X().GridPanel()
        .ColumnModel(
        Html.X().Column()
        .Text("companyId")
        .Width(50)
        .Flex(1)
        .Editor(Html.X().NumberField()),
        Html.X().Column()
        .Text("SettlementAccount")
        .Width(125)
        .Flex(1)
        .Editor(
         Html.X().ComboBox()
            .ValueField("SettlementAccountId")
            .DisplayField("Name")
            .Store(
            Html.X().Store()
            .ID("StoreSettlementAccountList")
            .AutoLoad(true)
            .Model(Html.X().Model()
            .Fields(
            new ModelField("SettlementAccountId", ModelFieldType.Int),
            new ModelField("Name", ModelFieldType.String)
            )
     
            )
                                                                      
            .Proxy(
            Html.X().AjaxProxy()
            .Url(Url.Action("GetSettlementAccountList"))
            .ActionMethods(actions =>
            {
                                                                         
            actions.Read = HttpMethod.POST;
            }
            )
     
            .Reader(
            Html.X().JsonReader().Root("result")
            )
     
            )
            .Parameters( para =>
            {
            para.Add(new StoreParameter("id", "record.get('companyId')", ParameterMode.Raw));
            }
            )
           )
       ) 
       )
       )
    Quote Originally Posted by Vladimir View Post
    We don't need full code, just create simple runable test case reproduces the issue. We cannot use just part of the code, it is better if we just run your ready sample

    - need to use 'Add' method of 'para' collection instead 'add' (C# is case sensitive language)
    - you have to use StoreParameter instead Parameter
    - 'record' reference is absent, you will get javascript error
  7. #7
    Hi @OriCoder,

    Do you need to load the ComboBox's Store remotely according the cell's value when a user click that cell to edit?

    If yes, you need something like this.
    https://examples2.ext.net/#/Form/Com...ombos_In_Grid/

    Here is a simplified Razor example.

    Example
    <!DOCTYPE html>
    
    <html>
    <head>
        <title>Ext.Net.MVC v2 Example</title>    
    </head>
    <body>
        @Html.X().ResourceManager()
    
        @(Html.X().GridPanel()
            .Height(200)
            .Store(Html.X().Store()
                .Model(Html.X().Model()
                    .Fields(Html.X().ModelField().Name("test"))
                )
                .Proxy(Html.X().AjaxProxy()
                    .Url(Url.Action("GetDataForGridPanel"))
                    .Reader(Html.X().JsonReader().Root("data"))
                )
            )
            .ColumnModel(Html.X().Column()
                .Text("Test")
                .DataIndex("test")
                .Editor(Html.X().ComboBox()
                    .DisplayField("text")
                    .ValueField("value")
                    .Store(Html.X().Store()
                        .AutoLoad(false)
                        .Model(Html.X().Model()
                            .Fields("value", "text")
                        )
                        .Proxy(Html.X().AjaxProxy()
                            .Url(Url.Action("GetDataForComboBox"))
                            .Reader(Html.X().JsonReader().Root("data"))
                        )
                    )
                )
            )
            .Plugins(Html.X().CellEditing()
                .Listeners(events =>
                {
                    events.BeforeEdit.Handler = @"var field = this.getEditor(e.record, e.column).field; 
                                                  field.allQuery = e.value;";
                })
            )
        )
    </body>
    </html>
    Controller Actions
    public ActionResult GetDataForCombobox(string query)
    {
        object[] data = new object[]
        {
            new 
            {
                text = query + " 1",
                value = "1"
            },
            new 
            {
                text = query + " 2",
                value = "2"
            },
        };
    
        return this.Store(data);
    }
    
    public ActionResult GetDataForGridPanel()
    {
        List<object> data = new List<object> 
        { 
            new { test = "test1" },
            new { test = "test2" },
            new { test = "test3" }
        };
    
        return this.Store(data);
    }
    Last edited by Daniil; Jan 18, 2013 at 3:26 PM.
  8. #8
    Hi Daniil

    Kind of.. in context of the linkied combo example what I need to do is look at the value of the cell on the right and its value, would be used to get my list of options from a database.
  9. #9
    Seems my example demonstrates it, doesn't?
  10. #10
    no that example shows picking a value on the left e.g. "state" and then this is passed to the options in the boxes to the right. I need start editing say "City" and it looks at the value of "state" which then uses this value to get the data from the database to give you combobox options. If I use

     .Url(Url.Action("GetSettlementAccountList/81))
    Then this will pull that account list from the db, just trying to make the "81" dynamic is where I am stuck.
Page 1 of 4 123 ... LastLast

Similar Threads

  1. [CLOSED] Editable Grid Panel - Razor
    By MTSI in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 22, 2012, 12:36 PM
  2. Combobox Grid Editor Dynamic
    By sysmo in forum 1.x Help
    Replies: 0
    Last Post: Aug 08, 2012, 7:36 PM
  3. Replies: 2
    Last Post: Feb 21, 2011, 5:22 AM
  4. [CLOSED] ComboBox editor in grid
    By PatrikG in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Jul 08, 2010, 4:30 PM
  5. [CLOSED] Grid Panel editor combobox default value
    By speedstepmem2 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 08, 2009, 8:38 AM

Tags for this Thread

Posting Permissions