Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #109060
    FerrisChamp
    Participant

    Hello,

    I am trying to recreate this

    columns: [
    	{
    		label: 'First Name', dataField: 'firstName', editor: 'input'
    	},
    	{ label: 'Last Name', dataField: 'lastName', editor: 'autoComplete' },
    	{
    		label: 'Product', dataField: 'productName', template: 'dropDownList', editor: {
    			template: 'dropDownList',
    			dataSource: ["Black Tea", "Green Tea",
    				"Caffe Espresso", "Doubleshot Espresso",
    				"Caffe Latte", "White Chocolate Mocha",
    				"Caramel Latte", "Caffe Americano",
    				"Cappuccino", "Espresso Truffle",
    				"Espresso con Panna", "Peppermint Mocha Twist"]
    		}
    	},

    which I found here: https://www.htmlelements.com/docs/grid-cell-edit/
    in C#, but I can’t figure it out. This is what I have so far.

    new GridColumn()
                        {
                            DataField = field.FieldName,
                            Label = field.AliasName,
                            ColumnGroup = field.GroupName,
                            ValidationRules = field.DataType.ValidationRules,
                            DataType = field.DataType.GetSmartType(),
                            CellsClassName = "font-change",
                            ClassName = "ColumnHeaderName",
                            Template = "dropdownlist",
                            Editor = "dropDownist"
                        });

    Thank you.

    #109067
    ivanpeevski
    Participant

    Hi FerrisChamp,

     

    Here is an example of a GridColumn object with a dropDownList editor and custom dataSource:

    new GridColumn()
    {
    DataField = “Product”,
    Label = “Product Name”,
    Template = “dropDownList”,
    Editor = new Dictionary<string, object>()
    {
    {“template”, “dropDownList” },
    {“dataSource”, new string[] {“Black Tea”, “Green Tea”,
    “Caffe Espresso”, “Doubleshot Espresso”,
    “Caffe Latte”, “White Chocolate Mocha”,
    “Caramel Latte”, “Caffe Americano”,
    “Cappuccino”, “Espresso Truffle”,
    “Espresso con Panna”, “Peppermint Mocha Twist”} },
    }
    }

     

    Best Regards,
    Ivan Peevski
    Smart UI Team
    https://www.htmlelements.com/

    #109069
    FerrisChamp
    Participant

    Thank you! This solved my problem!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.