[CLOSED] Combobox in header items returns value.split error

  1. #1

    [CLOSED] Combobox in header items returns value.split error

    I'm using the FilterHeader plugin on gridpanel. I have a field "CompanyTypeId" which uses a rendererer function to output the lookup name. I want a combobox that displays the names but sets the filter to the Id column. It looks like it get's most of the way to working but then expects the getValue output of the combobox to be a string.

    error: Uncaught TypeError: value.split is not a function Ext.define.statics.behaviour.numeric.is
    i.e. var parts = value.split(/(>=|<=|>|<)/i);

    Any help would be appreciated.

    @(Html.X().GridPanel().ID("CompanyList")
                .Store(
                        Html.X().Store().AutoLoad(true).AutoSync(true).Model(Model.CompanyModel)
                            .Proxy(
                                Html.X().AjaxProxy()
                                   .Url(Url.Action("SetupGet" + RecNamePlural))
                                    .Reader(Html.X().JsonReader().Root("data"))
                                                    .API(x => x.Update = Url.Action("SetupUpdate"+RecName))
                                                    .API(x => x.Create = Url.Action("SetupCreate"+RecName))
                                            .API(x => x.Destroy = Url.Action("Destroy"+RecName))
                                    .Writer(x => x.Add(Html.X().JsonWriter().AllowSingle(true).Root("Data").Encode(true)))
                                    )
                )
                .ColumnModel(
                        Html.X().Column().Text("Id").DataIndex("CompanyId").MinWidth(80),
                        Html.X().Column().Text("Name").DataIndex("Name").MinWidth(100).Flex(1),
                        Html.X().Column().Text("Area").DataIndex("CompanyTypeId").MinWidth(100).Flex(1).Renderer("CompanyTypeRenderer")
                            .HeaderItems(
    Html.X().ComboBox().QueryMode(DataLoadMode.Local).StoreID("CompanyTypeStore").Name("CompanyTypeId").DisplayField("Name").ValueField("CompanyTypeId")
                            )
                      
                )
                        .Plugins(
                                X.FilterHeader()
                            )
        )
    }
    Model:
    return new Model()
                {
                    Fields =
                    {
                      new ModelField("CompanyId", ModelFieldType.Int),
                      new ModelField("Name", ModelFieldType.String),
                      new ModelField("CompanyTypeId", ModelFieldType.Int),
                    },
                    IDProperty = "CompanyId",
                    Name = "Company"
                };
    Last edited by Daniil; May 26, 2015 at 4:14 PM. Reason: [CLOSED]
  2. #2
    Hi @AaronDev,

    Is it an option to change this
    new ModelField("CompanyTypeId", ModelFieldType.Int)
    to this
    new ModelField("CompanyTypeId", ModelFieldType.String)
    ?

    Or, maybe, it doesn't work anyways?
  3. #3
    Thanks Daniil

    Yes it works. Just not sure I want to change the Models Id type as it's used throughout the software. If anybody else try's this note you have to change store.getById(value) to store.getById(value.toString()) in renderers or were you use getById

    Would it be an option to override the getValue function of that combobox to output a string?
    Last edited by Daniil; May 22, 2015 at 10:01 AM.
  4. #4
    Would it be an option to override the getValue function of that combobox to output a string?
    I would not do that. I guess it might broke something else.

    Please try this:
    @(Html.X().ComboBox()
        .CustomConfig(cc =>
            cc.Add(new ConfigItem
            {
                Name = "getFilterValue",
                Value = "function() { return this.getValue().toString() }",
                Mode = ParameterMode.Raw
            })
        )
    )
    If defined a ComboBox's .getFilterValue() will be used by FilterHeader instead of .getValue().
  5. #5
    That worked perfectly. Many thanks for the help.

Similar Threads

  1. Replies: 4
    Last Post: Jul 15, 2014, 10:59 AM
  2. [CLOSED] disable items of Combobox in MVC giving JS Error
    By PriceRightHTML5team in forum 2.x Premium Help
    Replies: 4
    Last Post: Sep 05, 2013, 12:07 PM
  3. [CLOSED] Rowselection in Codebehind returns 0 items
    By blueworld in forum 2.x Premium Help
    Replies: 2
    Last Post: Aug 22, 2013, 2:17 PM
  4. [CLOSED] ComboBox getValue returns text instead of value
    By marco.morreale in forum 2.x Premium Help
    Replies: 9
    Last Post: Jun 19, 2012, 7:22 AM
  5. [CLOSED] Error if AjaxMetod returns ""
    By Jurke in forum 1.x Premium Help
    Replies: 2
    Last Post: Mar 25, 2009, 12:04 PM

Tags for this Thread

Posting Permissions