Kendo UI Editor: Modify command content before its inserted - kendo-ui

For the various kendo editor tools like List, Table etc. we need to change the content before its inserted into the editor. For example, add a CSS class to a UL element or add some data properties.
How do we achieve this? We looked at the command event, however, changing values of the command does not seem to have any impact in the final HTML that is inserted into the editor.

Related

Export Dropdown Selection in Kendo Editor to Word Document

I've been trying to get a selected dropdown option to appear in a Word Document on export.
The current default behavior is that all option tags appear in the exported document with no indication of which was selected. (This makes sense that this behavior would occur since the export function is simply exporting all the html as plain text).
So far, these are the approaches I've tried (none of which work):
-Capture the export event before it is sent to the controller via the javascript execute event (thus being able to strip out any unwanted text). The issue is the execute event and exportas event are asynchronous, so I can't modify the file before the export event call is executed.
-Modify the text on the controller side before it is converted to a Word document and downloaded (the text is sent through without special characters, which makes it nearly impossible to parse)
-Attempt to replace the dropdown with a kendo autocomplete widget (this would also be an acceptable solution). The widget does not render properly inside the document. All of the datasource options are there and even filters corretly, but it does not style correctly or open.
Has anyone else been able to find a solution to this problem or have another approach I could use?
EDIT:
As per requested, here is a screenshot of the base code:
My initial idea on how you could accomplish this:
1. Pull that select list out of your editor.
2. Bind an event handler to the change event of your list to add the value of your list into the editor. Are you using JQuery in your project? It's a dependency for Kendo so this ought to work:
$("#selectListId").on("change", function () {
$("#editor").val( $("#selectListId").val());
});
In reality though I'm guessing this approach will be used to populate some template of text with values selected by the user? In that case, you may want to save the template first before applying the value selected.
Now that you've identified you need that dropdown menu to be usable on the exported word document, attempt the following:
Create a new word document.
In that word document, open the Developer tab. (If you don't know about it, google how to enable it)
Insert a new Dropdown Menu Content Control using the Developer tab.
Select this content control, then open Properties menu item on Developer tab.
Update the content control with your values:
Save this word document.
Use the Kendo Editor Import to import this document containing your template.
Attempt exporting what was just imported.
If that works and the editor has editable dropdowns from that content control, I will be very surprised... Good luck!

Sitecore CSS class layout for table in rich-text editor

I need to define my own styling for table like we have some default table CSS class layouts as shown below.
although after some Google I found solution that how to define class for specific row, cell, column or main class for table but not complete styling layout like above.
The Telerik website shows how to get your own custom table classes into their editor. See the link below for how to create the style sheet.
http://demos.telerik.com/aspnet-ajax/editor/examples/tablelayoutcssfile/defaultcs.aspx
Once you've created your style sheet you'll need to modify the EditorPage.aspx file which Sitecore uses to render the Telerik RadEditor control.
<site root>\sitecore\shell\Controls\Rich Text Editor\EditorPage.aspx
Add the following line as a property of the telerik:RadEditor control.
TableLayoutCssFile="~/sitecore/shell/Controls/Rich Text Editor/TableLayoutCss.css"
The above assumes the CSS file you created is named TableLayoutCss.css.

Kendo UI Grid Export to excel with extra info in the file?

I have an application which uses Kendo UI grid. The excel export features works fine. Now, I added some extra controls on the page. User can select some values, and then click 'refresh' button to update the data source of the grid. So that the grid won't load too much data all in once.
The question is: the export will export whatever on the screen (including all pages). When user opens the excel file, he/she won't know what parameters used to generate this.
For example, on the page, it has a date control, use select 1/1/2015, click refresh, grid shows all data for that date. When export, how the user know this selected date? It is not in the columns in grid.
What I want to have is an extra row at the top, which shows something like:
Date: 1/1/2015, Para2: value2, ...
Is this possible in current Kendo ui grid? or have to manipulate the excel file (which we want to avoid at any cost)?
Thanks
we can use mult-column feature of latest kendo to add one more row at the top and covers all existing columns, and use it for extra information.
http://demos.telerik.com/kendo-ui/grid/multicolumnheaders
However, I need to dynamically change the title of this row, i.e. when user select a parameter from drop down list, I need to reflect the change in the title. This can be done by jQuery. The problem is Export of Kendo. The export seems using whatever the initial title is. i.e. if I change parameters to:
Date: 2/1/2015, Para2: value2, ...
jQuery changed the title in this multi-column row. But the export still has:
Date: 1/1/2015, Para2: value2, ...
Anyone knows how to fix this? Or, can't be done in current Kendo?
Thanks

Custom RTE Dropdown in Sitecore 7.0

My client desires to have a dropdown similar to Symbols Dropdown in the RTE (sitecore version 7.0). The client wants different dropdowns for different symbol types, for example, a dropdown having Greek Symbols Upper case, a dropdown having Greek Symbols Lower case, a dropdown having Mathematical Symbols and a dropdown having Other/Misc types of symbols.
I have tried to understand how RadControls work and how to add this on Telerik RadControl but I am unable to map the concept to sitecore's rich text editor. Additionally, I have tried to understand how existent Symbols Dropdown in RTE works but since its code is embedded in Sitecore.Client dll I cant understand much from it.
Can some one please detail the steps to achieve this?
Thanks,
Vaibhav.
You can add your own custom drop list or drop button to the RTE.
Switch to the core database and add a new button in the toolbar of the RTE profile you are using (e.g. /sitecore/system/Settings/Html Editor Profiles/Rich Text Full/Toolbar 1)
Make sure the template of the button is of type Html Editor Custom Drop Down or Html Editor Custom Drop Down Button, these can be found in /sitecore/templates/System/Html Editor Profiles. Give a name in the 'Click' field, e.g. InsertCustomSymbols
Add child items to your button to create the "symbols" or text you need using Html Editor List Item template. The 'Header' value is what will be displayed in the dropdown list and 'Value' is what will get inserted (e.g. your greek symbols).
You now need to handle the click event of the button, create a file with the following JS:
RadEditorCommandList["InsertCustomSymbols"] = function(commandName, editor, args) {
var val = args.get_value();
editor.pasteHtml(val);
args.set_cancel(true);
}
Create a patch config to add the JS file:
<clientscripts>
<htmleditor>
<script src="/location/to/custom.js" language="javascript" key="customJs" />
</htmleditor>
</clientscripts>
If you used the Drop Down Button then also add a css style to set the icon, it should also be the same name as the 'Click' field.
<style type="text/css">
span.InsertCustomSymbols
{
background-image:url('/path/to/icon.gif');
}
</style>
I didn't style it but you get the idea. Add as many as you need, make sure you set the correct RTE profile.
You can find a bit more info in this Telerik Custom Dropdown demo

Add an icon instead of a text in a column

in JQGrid 3.8, is it possible to have an icon instead of text in a column ?
I don't think it's possible but if you have a trick, i'd be happy
There are many ways to add icons in the grid. First way is: the data which be placed in the column header (colNames) or inside of the cell data could be HTML data. So you can easy insert the <img> element in the grid. One more method is th use custom formatters. See here some demos. If the standard jQuery UI icons contain all the icons which you need I would recommend you to use there.

Resources