Telerik Forums
Kendo UI for jQuery Forum
2 answers
1.3K+ views

I've got a template that's displaying comments. There's no loop inside the template itself since I'm letting the datasource handle that. I have a situation now though, where I need to add content to the template on the 50th (for example) iteration of the template. If I had a loop, that would be easy, but I'm hoping to not have to refactor my existing template to manually include one.

JS:

function generateDiscussionView(container_id) {
    var template_html = $('#discussion_template').html();  
    var template = kendo.template(template_html, {useWithBlock: false});
     
    discussion_datasource = new kendo.data.DataSource({
        transport: {
            read: {
                url: "/DiscussionsController.cfc?method=getDiscussion",
                type: "get",
                dataType: "json",  
                data: {
                    ContainerID: container_id
                }
            }          
        },
        schema : {
            type: "json",
            data: "Comments"
        }
    });
 
    discussion_datasource.bind("change", function() {      
        var view = discussion_datasource.view();
        var html = "";
         
        html = kendo.render(function(data) {   
            return template($.extend(data, {IsAdmin: is_admin, AURID: aur_id}));
        }, view);
         
        $('#discussion_display').html(html);
    });
     
    discussion_datasource.read().then(function() {     
        var data = discussion_datasource.data();   
        data = data[0];
         
        global_container_id = container_id;
    }
}

Template:

<div id="discussion_display" class="list-items-content-area k-listview col-xs-12"></div>
 
<script id="discussion_template" type="text/x-kendo-template">
    <div class="col-xs-12 disc-comment">
        <div class="disc-nav"><img src="#= data.Photo #" onerror="imgError(this);" title="#= data.Poster #" /></div>
        <div class="overflow-hidden">
            <div id="display_comment_#= data.CommentID #">
                <p class="blue">#= data.Poster #</p>
                # var formatted_text = data.Text.replace(/(?:\r\n|\r|\n)/g, '<br />'); #
                <p>#= formatted_text #</p>
                <p class="small text-muted">
                    #= data.Created #
                    # if (data.Editable) { #
                        <a href="javascript:;" onclick="editComment(#= data.CommentID #);">Edit</a>
                    # } #
                    # if (data.Editable || data.IsAdmin) {#
                        <a href="javascript:;" onclick="deleteComment(#= data.AURID #, #= data.CommentID #);">Delete</a>
                    # } #
                </p>
            </div>
            # if (data.Editable) { #
                <div id="edit_comment_#= data.CommentID #" style="display: none;">
                    <textarea id="comment_#= data.CommentID#" class="form-control input-sm">#= data.Text #</textarea>
                    <a id="add_comment_#= data.CommentID #" class="btn btn-default" data-commentid="#= data.CommentID #">
                        <i class="fa-icon-plus"></i>
                    </a>
                    <a href="javascript:;" onclick="cancelEdit(#= data.CommentID #);">Cancel</a>
                </div>
            # } #
        </div>
    </div>
</script>

 

Ashleigh L
Top achievements
Rank 1
 answered on 13 Jul 2016
2 answers
113 views

The chart in the attached image was created using MS Chart.

Does Kendo UI Charts support this outcome?

If so, please provide example.

Thank you.

Ted
Top achievements
Rank 1
 answered on 13 Jul 2016
1 answer
1.5K+ views

Hi,

I would like to use a grid that will data. The data cannot be edited/deleted once saved. But I want the ability to add a new row. The add new row can be via popup (preferable) or inline. Is this possible? 

All examples I've seen have the Edit/Delete options on each row. When a new row is added these buttons are Save and Cancel...

If using inline editing I want no Edit/Delete buttons to be visible but when a row is added I need the Save Cancel.... better still if I have a popup for adding a new row then I would not need a column for the Edit/Delete.

Thanks.

Stefan
Telerik team
 answered on 13 Jul 2016
1 answer
5.5K+ views
I'm Using Kendo UI MVC.I need a MultiSelect with checkbox for each item to allow me select multiple of items.I need same layout for existing kendo UI multiselect.

Could you please share me the sample example?
Georgi Krustev
Telerik team
 answered on 13 Jul 2016
3 answers
171 views

Hi

I'm trying to use custom theme builder. http://demos.telerik.com/kendo-ui/themebuilder/ but it generates corrupted css now. It used to work correctly back in April.

 

.k-slider-horizontal .k-tick {
  background-image: url('url("http://kendo.cdn.telerik.com/2016.2.607/styles/Metro/sprite_2x.png")/slider-h.gif');
}
.k-slider-vertical .k-tick {
  background-image: url('url("http://kendo.cdn.telerik.com/2016.2.607/styles/Metro/sprite_2x.png")/slider-v.gif');
}

Could you please fix it? Also, is there anyway to specify local path?

Iliana Dyankova
Telerik team
 answered on 13 Jul 2016
5 answers
927 views
How do you allow clicking on a hyperlink in the Editor? Is this possible and how do I enable this? I see that you have them in your Editor demo, but I cannot click on them to open there either.
Ianko
Telerik team
 answered on 13 Jul 2016
2 answers
391 views

I have a column which creates a dropdown list from a foreign key value. 

I change the value in my application, the variable value changes but the drop down list does not update.

var dashboardTypeNames = [];
var menuNames = [];

columns: [              

              { field: "DashboardTypeId", values: dashboardTypeNames, title: "Dashboard Type" },
              { field: "MenuId", values: menuNames, title: "Menu" },              
        ],

On start I populate the dashboardTypeNames array with data using ajax the selected item value is then passed to another ajax which i want to populate the second dropdown I have an onchange function which gets the value of the selected item.

Anyhelp would be appreciated

Boyan Dimitrov
Telerik team
 answered on 13 Jul 2016
3 answers
191 views

Hi,

I'm using kendo with Angular, and looking for a way to format the tooltip with thousand coma seperator (what I have now, is not working)

and also have a number in the donut.

I know how to do it in JS but not in Angular..

this is my code (it's all on the html page) , can you please help me?

 

 

<div class="panel panel-default" style="width: 530px; margin-left:10px;float: left;">
 <div class="panel-body">
   <div 
kendo-chart 
k-title="{text: 'POR vs Burden', color: '#3d3c3c'}"
k-legend="{ position: 'bottom' }" 
k-series-defaults="{ type: 'donut', startAngle: 270, labels: {
   visible: true,
holeSize: 45,
   background: 'transparent' }}"
k-series="[{
name: 'Value',
               field: 'Value',                
               categoryField: 'Category',
              labels: {
               visible: false
           },
                        holeSize: 70,
               visibleInLegendField: 'visibleInLegend',
               padding: 10
             }]"
            k-series-colors="['#b2473e', '#eb8a44']"
   k-tooltip ="{visible: true, format:'{0:N0}'}"
   k-data-source="burdenMoneydata"     
   style="height: 300px; width: 500px;">
</div>
 </div>
</div>

Daniel
Telerik team
 answered on 13 Jul 2016
5 answers
953 views

I use the functionality of the multiselect to add or remove items, but I need a confirmation before an item will be deleted.

So I use the DataBound-Event to save the current values an everytime the Change-Event is triggered I compare the current values against the previous:

 function onChange() {
        var previous = this._savedValues;
        var current = this.value();
        if (current.length < previous.length) {
            var diff = $(previous).not(current).get(0);
            if (diff != null) {
                var memberName = diff.substring(diff.indexOf('CN=') + 3, diff.indexOf(','));
                var string = 'Delete' +  memberName + '?';
                if (confirm(string.replace('{0}', memberName))) {
                    console.log("confirmed"); // nothing more happens here
                }
                else {
                    //reset;
                    this.value(previous);
                }
            }
        }
        saveCurrent(this);
    } 

    function saveCurrent(multi) {
        multi._savedValues = multi.value().slice(0);
    } 

    function onDataBound() {
        saveCurrent(this);
    }​

The problem is: This doesn't really work properly. If I add and remove some items, the multiselect deletes more items than I want to remove. 

 

Kiril Nikolov
Telerik team
 answered on 13 Jul 2016
1 answer
310 views

Hello,

A question about validation in kendo UI datasource.

I have a kendo grid and this grid has defined an editor template which is a custom directive 'tagSearch'. This custom directive has an input element into it with type text:

 editor: function (container, options) {
                                    var tagSelection = $('<div name="' + options.field + '"><tag-search></tag-search></div>');
                                    tagSelection.appendTo(container);
                                }

 

In validation method I have the following code (into dataSource):

 

  schema: {
                            model: {
                                id: "itemId",
                                fields: {
                                    tag: {
                                        type: "string",
                                        validation: {
                                            required: true,
                                            tagvalidation: function (input) {
                                                if (input.is("[type=text]")) {
                                                   
                                                  if(...some validation...){

                                                     input.attr("data-tagvalidation-msg", "This tag is already added!");

                                                     return false;
                                                    }
                                                return true;
                                            }
                                        }
                                    }
                                }
                            }
                        }

 

But the validation message with the text "This tag is already added!" does not appear. So what could be the possible reason(s) for this issue

 

Thanks and Regards!

Rosen
Telerik team
 answered on 13 Jul 2016
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?