how to add color flag dynamically to the dropdownlist in kendoUI - asp.net-mvc

I am using colors drop down in list view.In this dropdown,From the datasource,I am able to display colors from my database.
what I want is that,In the drop down,For each value i want to display name of color and squarish box filled with this color.
I have implemented the below for displaying drop down,
<select STYLE="width:90px;height:auto" id="Flag" data-bind="value:prj_flag" data-text-field="usr_color" data-value-field="usr_id" data-source="FlagdatSource" data-role="dropdownlist"></select>

Do you know how to define it NOT using KendoUI? I mean, if you know how to do it using HTML select then you should be able implementing the same in KendoUI using template in DropDownList (check KendoUI DropDownList). Doing this, you reduce your problem to a CSS question instead of a KendoUI.

You should create your server to return not only the text of the for these colors but also the color codes. Then all you need to to is to create a template.
Here it is in action, the only difference is that it is using local data (not coming from a server).

Related

Is it possible to display the save/cancel buttons in Vaadin 14 on GridPro when editing the grid

In Vaadin 8's grid you would see the Save/Cancel button when doubleclicking on a row in GridPro. In Vaadin 14 Grid Pro doesn't seem to have that save save/cancel button by default. Is there a way to enable it?
It seems like it should be possible because we have getEditor().addSaveListener() etc.
As an extra question whenever I do any action in the grid it seems to only call the addCancelListener(). Is there a reason for this? The primary question of course is if it's possible to show the save/cancel buttons in GridPro
GridPro adds another editing functionality to the Grid, which is not using grid.getEditor() at all. So these are not to be mixed.
GridPro is designed for cell-based spreadsheet like editing with improved keyboard navigation, thus save/cancel buttons are not there. Editable columns are added using grid.addEditColumn(..) method and using either built in fields like below, or custom type. In both cases saving of the value is handled in the call back provided.
grid.addEditColumn(Person::getEmail)
.text((item, newValue) ->
item.setEmail(newValue))
.setHeader("Email (editable)");
So save / cancel events from grid's editor are not emitted. Also this functionality does not use Binder by default. You need wire Binder yourself if you need it, see example in Vaadin's cookbook.
Basic Grid has builtin row based editor, which uses also Binder. With that one you can use it Binder and editor in buffered mode, and for example add an additional component column to where you have edit / cancel buttons, what ever you like. There is rather good code example at Vaadin's component pages.
In summary there are two different editing facilities provided and these are not to be mixed.

jqGrid: edit form in the subgrid area accordion

We are using Jqgrid but we need to perform a custom editing.
In particular we want to view/edit the detail of a row inside the accordion of a subgrid area (instead of real subgrid)...
Basically we are looking for a way to redirect the content of the edit popup to the subgrid area.
Anyone have some ideas about how to do it?
Peter
If I understand correct the problem you may look at this demo in case you use Guriddo jqGrid JavaScript. In your case the html file can contain template form, where you can get the values from the row and put it in the form.
If you have difficulties we can prepare a online demo.

How to apply #Html.Raw to each of the SelectListItem.Text properties?

I need to apply style property to my selectlistitem text, which is static in razor html.
Styled select boxes can only be done by the help of javascript libraries which usually hides the original select element and create a styled div over it which looks like a dropdown.
If you really want to show your dropdowns with a customized style, try searching in Google for "jquery select plugins".
We usually use https://select2.github.io/. Easy to use and very flexible.

color a cell of a KendoUI grid via MVC controller

In a ASP.Net MVC application I wish to show in a kendo grid column a cell () colored via a color I receive in the form #FFAABB from the controller... how can I do that?
can I just apply the color via style received in the viewbag or is there a better way?
Thanks in advance
First of all, is the color is going to be only one that is being passed from the Controller and if so then you can use Viewbag or a Static variable.
But if the colors are going to differ with each rows of the Grid then its better to pass them along the Model and use a template to set the color, please see a demo I created for the same: Column Coloring from Model

UI MVC Grid with custom command

I have a grid which displays a list of branches. I also have a ContactDetails button on each row which is a custom command popping a Kendo window displaying the details. It all works fine. However, I want these details to be editable. How should I approach this? I cannot seem to be able to access the model through the window.
I am using the code from their custom command demo: http://demos.telerik.com/aspnet-mvc/grid/custom-command
Ultimately, what I want is the grid to pass in the model representing the relevant row into the window so that the model can be modified and then persisted on the database.

Resources