or
Hi,
I am using the latest Kendo UI version (2016.2.714) and found a bug in the colorpicker.
The buttons (Apply and Cancel) are rendered as
<
button
class
=
"k-button k-primary apply"
>Apply</
button
>
<
button
class
=
"k-button cancel"
>Cancel</
button
>
(see kendo.colorpicker.js line 504 for details or check the source on github)
When included in a form both of the buttons always cause the form to get submitted when they get clicked as this is the common behavior of a button tag. Both of them should have the type attribute set to "button" to prevent the form from getting submitted. The rendered buttons should look like this:
<
button
type
=
"button"
class
=
"k-button k-primary apply"
>Apply</
button
>
<
button
type
=
"button"
class
=
"k-button cancel"
>Cancel</
button
>
Best regards
Thomas
I tried putting color picker inside the window but the picker is behaving strangely and is hidden. Do we have a clean css to fix this problem?
@(Html.Kendo().Editor()
.Name(
"Editor"
)
.Tools(tools => tools
.Clear()
.Bold().Italic().Underline().Strikethrough()
.JustifyLeft().JustifyCenter().JustifyRight().JustifyFull()
.InsertUnorderedList().InsertOrderedList()
.Outdent().Indent()
.CreateLink().Unlink()
.InsertImage()
.InsertFile()
.SubScript()
.SuperScript()
.TableEditing()
.ViewHtml()
.CleanFormatting()
.Formatting()
.FontName()
.FontSize()
.FontColor(color => color.Palette(
new
string
[] {
"#ffffff"
,
"#000000"
,
"#e7e6e6"
,
"#44546a"
,
"#5b9bd5"
,
"#ed7d31"
,
"#a5a5a5"
,
"#ffc000"
,
"#4472c4"
,
"#70ad47"
,
"#f2f2f2"
,
"#7f7f7f"
,
"#d0cece"
,
"#d6dce4"
,
"#deebf6"
,
"#fbe5d5"
,
"#ededed"
,
"#fff2cc"
,
"#d9e2f3"
,
"#e2efd9"
,
"#d8d8d8"
,
"#595959"
,
"#aeabab"
,
"#adb9ca"
,
"#bdd7ee"
,
"#f7cbac"
,
"#dbdbdb"
,
"#fee599"
,
"#b4c6e7"
,
"#c5e0b3"
,
"#bfbfbf"
,
"#3f3f3f"
,
"#757070"
,
"#8496b0"
,
"#9cc3e5"
,
"#f4b183"
,
"#c9c9c9"
,
"#ffd965"
,
"#8eaadb"
,
"#a8d08d"
,
"#a5a5a5"
,
"#262626"
,
"#3a3838"
,
"#323f4f"
,
"#2e75b5"
,
"#c55a11"
,
"#7b7b7b"
,
"#bf9000"
,
"#2f5496"
,
"#538135"
,
"#7f7f7f"
,
"#0c0c0c"
,
"#171616"
,
"#222a35"
,
"#1e4e79"
,
"#833c0b"
,
"#525252"
,
"#7f6000"
,
"#1f3864"
,
"#375623"
,
"#c00000"
,
"#ff0000"
,
"#ffc000"
,
"#ffff00"
,
"#92d050"
,
"#00b050"
,
"#00b0f0"
,
"#0070c0"
,
"#002060"
,
"#375623"
,
}))
.BackColor(color => color.Palette(
new
string
[] {
"#ffffff"
,
"#000000"
,
"#e7e6e6"
,
"#44546a"
,
"#5b9bd5"
,
"#ed7d31"
,
"#a5a5a5"
,
"#ffc000"
,
"#4472c4"
,
"#70ad47"
,
"#f2f2f2"
,
"#7f7f7f"
,
"#d0cece"
,
"#d6dce4"
,
"#deebf6"
,
"#fbe5d5"
,
"#ededed"
,
"#fff2cc"
,
"#d9e2f3"
,
"#e2efd9"
,
"#d8d8d8"
,
"#595959"
,
"#aeabab"
,
"#adb9ca"
,
"#bdd7ee"
,
"#f7cbac"
,
"#dbdbdb"
,
"#fee599"
,
"#b4c6e7"
,
"#c5e0b3"
,
"#bfbfbf"
,
"#3f3f3f"
,
"#757070"
,
"#8496b0"
,
"#9cc3e5"
,
"#f4b183"
,
"#c9c9c9"
,
"#ffd965"
,
"#8eaadb"
,
"#a8d08d"
,
"#a5a5a5"
,
"#262626"
,
"#3a3838"
,
"#323f4f"
,
"#2e75b5"
,
"#c55a11"
,
"#7b7b7b"
,
"#bf9000"
,
"#2f5496"
,
"#538135"
,
"#7f7f7f"
,
"#0c0c0c"
,
"#171616"
,
"#222a35"
,
"#1e4e79"
,
"#833c0b"
,
"#525252"
,
"#7f6000"
,
"#1f3864"
,
"#375623"
,
"#c00000"
,
"#ff0000"
,
"#ffc000"
,
"#ffff00"
,
"#92d050"
,
"#00b050"
,
"#00b0f0"
,
"#0070c0"
,
"#002060"
,
"#375623"
,
}))
).Encode(
false
)
.Value(@<text>
<p>
Kendo UI Editor allows your users to edit HTML
in
a familiar, user-friendly way.<br />
In
this
version, the Editor provides the core HTML editing engine, which includes basic text formatting, hyperlinks, lists,
and image handling. The widget <strong>outputs identical HTML</strong> across all major browsers, follows
accessibility standards and provides API
for
content manipulation.
</p>
<p>Features include:</p>
<ul>
<li>Text formatting & alignment</li>
<li>Bulleted and numbered lists</li>
<li>Hyperlink and image dialogs</li>
<li>Cross-browser support</li>
<li>Identical HTML output across browsers</li>
<li>Gracefully degrades to a <code>textarea</code> when JavaScript
is
turned off</li>
</ul>
<p>
Read <a href=
"http://docs.telerik.com/kendo-ui"
>more details</a> or send us your
<a href=
"http://www.telerik.com/forums"
>feedback</a>!
</p>
</text>)
.ImageBrowser(imageBrowser => imageBrowser
.Image(
"~/Content/UserFiles/Images/{0}"
)
.Read(
"Read"
,
"ImageBrowser"
)
.Create(
"Create"
,
"ImageBrowser"
)
.Destroy(
"Destroy"
,
"ImageBrowser"
)
.Upload(
"Upload"
,
"ImageBrowser"
)
.Thumbnail(
"Thumbnail"
,
"ImageBrowser"
))
.FileBrowser(fileBrowser => fileBrowser
.File(
"~/Content/UserFiles/Images/{0}"
)
.Read(
"Read"
,
"FileBrowser"
)
.Create(
"Create"
,
"FileBrowser"
)
.Destroy(
"Destroy"
,
"FileBrowser"
)
.Upload(
"Upload"
,
"FileBrowser"
))
)
.k-colorpalette
{
border
:
1px
solid
gray
;
padding-right
:
3px
;
}
.k-palette .k-item
{
border-style
:
solid
;
border-color
: White;
border-width
:
0px
3px
0px
3px
;
}
.k-palette tr:first-child
{
border-top
:
3px
solid
white
;
border-bottom
:
5px
solid
white
;
}
.k-palette tr:last-child
{
border-top
:
5px
solid
white
;
border-bottom
:
3px
solid
white
;
}
01.
<
div
class
=
"silx-setting-settings-dialog ui-dialog-content ui-widget-content"
id
=
"ui-id-5"
style
=
"width: auto; min-height: 50px; max-height: none; height: auto;"
>
02.
<
div
class
=
"silx-row"
>
03.
<
label
>!! Action label:</
label
>
04.
<
input
type
=
"text"
class
=
"silx-setting input settingLabel"
value
=
"Systematic Rejection"
>
05.
</
div
>
06.
07.
<
script
type
=
"text/javascript"
>
08.
09.
var as_Color = "#cccccc";
10.
11.
12.
$(".settingBackgroundColor").kendoColorPicker({
13.
value: as_Color,
14.
buttons: false,
15.
change: function(e) {
16.
$(".previewSettingImage").css("backgroundColor", e.value);
17.
},
18.
select: function(e) {
19.
$(".previewSettingImage").css("backgroundColor", e.value);
20.
}
21.
});
22.
</
script
>
23.
<
div
class
=
"silx-row"
>
24.
<
label
>!! Background color:</
label
>
25.
<
span
role
=
"textbox"
aria-haspopup
=
"true"
class
=
"k-widget k-colorpicker k-header"
aria-disabled
=
"false"
tabindex
=
"0"
aria-label
=
"Current selected color is #cccccc"
aria-owns
=
"6fb0d2e4-e256-4d54-9bb3-853eb40cdec6"
><
span
class
=
"k-picker-wrap k-state-default"
><
span
class
=
"k-selected-color"
style
=
"background-color: rgb(204, 204, 204);"
></
span
><
span
class
=
"k-select"
unselectable
=
"on"
><
span
class
=
"k-icon k-i-arrow-s"
unselectable
=
"on"
></
span
></
span
></
span
><
input
class
=
"silx-setting input settingBackgroundColor"
data-role
=
"colorpicker"
style
=
"display: none;"
></
span
>
26.
</
div
>
27.
28.
<
script
type
=
"text/javascript"
>
29.
$(".settingImage").kendoComboBox({
30.
dataTextField: "text",
31.
dataValueField: "value",
32.
template: '<
span
class
=
"k-state-default"
><
img
width
=
"26"
height
=
"26"
src
=
"/Root/Global/plugins/silx-extendable-dashboard/img/silcActions/#:data.text#"
alt
=
"#:data.text#"
/></
span
>',
33.
dataSource:
34.
[
35.
{ text: "Systematic Rejection.png", value: "Systematic Rejection.png" },
36.
{ text: "dashboard-exit.png", value: "dashboard-exit.png" },
37.
{ text: "logo-vertech.png", value: "logo-vertech.png" }
38.
],
39.
change: function(e) {
40.
$(".previewSettingImage").css("background-image", "url(/Root/Global/plugins/silx-extendable-dashboard/img/silcActions/" + e.sender.input.val() + ")");
41.
}
42.
});
43.
44.
var ao_KendoCombo = $("input.silx-setting.settingImage:hidden").data("kendoComboBox");
45.
ao_KendoCombo.value("Systematic Rejection.png");
46.
47.
$(".addImageFile").kendoButton(
48.
{
49.
click: function(e) {
50.
UploadImageFile(e);
51.
}
52.
}
53.
);
54.
</
script
>
55.
<
div
class
=
"silx-row"
>
56.
<
label
>!! Image:</
label
>
57.
<
span
class
=
"k-widget k-combobox k-header silx-setting input settingImage"
style
=
""
><
span
tabindex
=
"-1"
unselectable
=
"on"
class
=
"k-dropdown-wrap k-state-default"
><
input
class
=
"k-input silx-setting input settingImage"
type
=
"text"
autocomplete
=
"off"
maxlength
=
"524288"
role
=
"combobox"
aria-expanded
=
"false"
tabindex
=
"0"
aria-disabled
=
"false"
aria-readonly
=
"false"
aria-autocomplete
=
"list"
aria-owns
=
""
aria-busy
=
"false"
style
=
"width: 100%;"
><
span
tabindex
=
"-1"
unselectable
=
"on"
class
=
"k-select"
><
span
unselectable
=
"on"
class
=
"k-icon k-i-arrow-s"
role
=
"button"
tabindex
=
"-1"
>select</
span
></
span
></
span
><
input
class
=
"silx-setting input settingImage"
data-role
=
"combobox"
aria-disabled
=
"false"
aria-readonly
=
"false"
style
=
"display: none;"
></
span
>
58.
<
button
type
=
"button"
class
=
"addImageFile k-button"
style
=
"font-size:20px;line-height:20px;"
data-role
=
"button"
role
=
"button"
aria-disabled
=
"false"
tabindex
=
"0"
>...</
button
>
59.
<
div
class
=
"previewSettingImage silc-action-button"
style
=
"background-color: rgb(204, 204, 204); float: right; margin-right: 175px; margin-top: 0px; background-image: url(http://192.168.1.185:8080/Root/Global/plugins/silx-extendable-dashboard/img/silcActions/dashboard-exit.png);"
></
div
>
60.
</
div
>
61.
62.
<
div
class
=
"silx-row"
>
63.
<
label
>!! Order:</
label
>
64.
<
input
type
=
"text"
class
=
"silx-setting input settingOrder"
value
=
"1"
>
65.
</
div
>
66.
67.
<
div
class
=
"silx-settings"
>
68.
<
button
class
=
"silx-settings-cancel"
>Annuler</
button
>
69.
<
button
class
=
"silx-settings-ok"
>Ok</
button
>
70.
</
div
></
div
>
<
script
type
=
"text/javascript"
>
function RefCarrierRank_ErrorHandler(e) {
}
function RefCarrierRankEdit(e) {
if (e.container[0].cellIndex == 2) {
$(".k-selected-color").css("width", "100%");
$("#RankColor").data("kendoColorPicker").open();
}
}
</
script
>
<
div
id
=
"RefCarrierRankContainer"
>
<
h3
style
=
"margin:1px;"
>Rank Dictionary</
h3
>
@(Html.Kendo().Grid(Model.AdminModel.GlobalDictionary.RefCarrierRankModels)
.Name("RefCarrierRank")
.Columns(columns =>
{
columns.Bound(item => item.Name);
columns.Bound(item => item.Rank)
.EditorTemplateName("RefCarrierRank/Rank");
columns.Bound(item => item.RankColor)
.ClientTemplate("<
div
class
=
'k-textbox'
style
=
'background-color:#=RankColor#; width:80px; height:20px;'
></
div
>")
.EditorTemplateName("RefCarrierRank/RankColor").Width(100);
columns.Command(command =>
{
command.Destroy();
}).Width(100);
})
.ToolBar(toolbar =>
{
toolbar.Create();
toolbar.Save();
})
.Events(events =>
{
events.Edit("RefCarrierRankEdit");
})
.Editable(editable => editable.Mode(GridEditMode.InCell).CreateAt(GridInsertRowPosition.Top))
.Navigatable(navigatable => navigatable.Enabled(true))
.Pageable(pageAction =>
{
pageAction.PageSizes(new int[] { 5, Model.AdminModel.GlobalDictionary.RefCarrierRankModels.Count });
})
.Sortable()
.Scrollable()
.Filterable()
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.ServerOperation(false)
.Events(events =>
{
events.Error("RefCarrierRank_ErrorHandler");
})
.Sort(sort =>
{
sort.Add("Rank").Ascending();
})
.Model(model =>
{
model.Id(i => i.RefCarrierRankID);
model.Field(i => i.Rank).DefaultValue(Model.AdminModel.GlobalDictionary.RefCarrierRankModels.Max(i => i.Rank) + 1);
model.Field(i => i.RankColor).DefaultValue("#a8a8a8");
})
.Read(read => read.Action("GetRefCarrierRanks", "Dictionary"))
.Create(create => create.Action("CreateRefCarrierRanks", "Dictionary"))
.Update(update => update.Action("UpdateRefCarrierRanks", "Dictionary"))
.Destroy(delete => delete.Action("DeleteRefCarrierRanks", "Dictionary"))
)
)
</
div
>
@(Html.Kendo().ColorPicker()
.Name("RankColor")
.Value("#=RankColor#")
.Opacity(true)
)