Telerik Forums
UI for ASP.NET MVC Forum
1 answer
288 views
Kendo tooltip overlaps the menu items. Any help is appreciated. Thank you.
Petar
Telerik team
 answered on 30 Nov 2020
1 answer
1.0K+ views

Hi there,

I have a grid with an excel export. I'm filtering the data source of the grid in javascript via some drop down lists. The filtering is done via the server. To be clear the when the grid's data source has been instructed to read it scrapes values from the filters using the .data() method and sends the filters values with the read request.

When I export to excel I noticed that it always returns the initial amount of data bound to the grid i.e. I have three rows when the page loads, I filter down to one row then export to excel and it returns all three rows. I noticed that when the export was happening it seemed to be exporting whatever was in the datasource options.data. I've found a workaround which is 

var settings = {};
$(me.selectors.excelExport).on('click', function() {
    var $this = $(this),
        $grid = $this.closest(me.selectors.role),
        grid = $grid.data(me.name);
    if (grid) {
        settings = grid.dataSource.options.data;
        grid.dataSource.options.data = grid.dataSource.view();
    }
});

on clicking export to excel i change the grid's datasource.options.data to be the current "view" of data and i store the original data.options.data.

var grid = $(me.selectors.role).data(me.name);
if (grid) {
    grid.bind(me.events.excelExport, function(e) {
        grid.dataSource.options.data = settings;
    });
}

then after the export has finished I  then restore the datasource.options.data with the value i stored before.

Should I need to do this or am I misunderstanding something? 
Please let me know if you need additional information or if I've not been clear enough.

 

Thanks

Tom

Anton Mironov
Telerik team
 answered on 27 Nov 2020
2 answers
3.6K+ views

Im trying to add a feature to an existing app that is using a rather dated Kendo version 2015.3.1111
I need to add a checkbox that when clicked will check or uncheck all checkboxes in the rows.  I'm aware of a newer feature in the 2017+ libraries, but for now we can't update this app.  So with jQuery, Ive looked at several examples, but its all over the place. Help? Examples?
My client and header template

 

columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' id='gridCheckbox'  onclick='handleClick(this);' value='#= LineItemId #'  #= Selected ? 'checked':'' # class='chkbx' />")
           .HeaderTemplate("<input type='checkbox' id='masterCheckBox' onclick='checkAll(this)'/>").Width(50);

 

 


Anton Mironov
Telerik team
 answered on 27 Nov 2020
3 answers
555 views

Hi,

In short, I don't want Folders to be inside of Folders. Basically I want root > all folders > files inside of folders

I don't want the possibility of creating a folder when the user is already inside of a folder.

Also, how can I make the method Create to NOT create a folder in the UI?

Even if I have this code inside of the Create method:

return Json(new { success = false, errMess = string.Empty }, JsonRequestBehavior.AllowGet);

In the UI it will still display a folder, although null (undefined, and null properties).

Martin
Telerik team
 answered on 27 Nov 2020
1 answer
134 views

Hi, I recently found out about the Form widget. I like the look-and-feel so far and tried to use it customized editortemplates loaded from gideditmode.popup with template name. The HTML rendered seems to be fine. I see data-bind attribute with correct binding but grid item data is not bound to the form.

Is my approach supported?

Neli
Telerik team
 answered on 26 Nov 2020
10 answers
1.2K+ views
Hello!
I use Combobox  with Ajax Loading.
And I have a question:
1) I have a code:
@model int
            
@(Html.Kendo().ComboBoxFor(x => x)
    .DataTextField("Description")
    .DataValueField("Id")
    .Placeholder("Select")
    .HtmlAttributes(new { style = "width:225px", id = Guid.NewGuid().ToString() })
    .DataSource(databinding => databinding
        .Read(read => read
        .Action("SelectComboboxItems", "Lumber")))
)
2) If I use DropDownListFor instead of ComboBoxFor...everything well works and DropDownList select OptionLabel (because I dont have item with Id = 0)
But If I use ComboboxFor...than I get this...(please see  zero.png)
Why Combobox does this?  I want that combobox set placeholder instead of 0, when I dont have item with Id=0
Petar
Telerik team
 answered on 26 Nov 2020
4 answers
122 views

As I add an identifier to the input of the GRID search box, I need to manipulate that element, in this case I need to put the focus on the element.

 

@(Html.Kendo().Grid<MPaises>()
            .Name("rgvListado")
            .Columns(columns =>
            {
              columns.Bound(c => c.Codigo);
              columns.Bound(c => c.Nombre);
              columns.Bound(c => c.Continente);
            })
            .ToolBar(t => t.Search().Text("Buscar Pais"))
            .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
            .Sortable()
            .Groupable()
            .Selectable(selectable => selectable
              .Mode(GridSelectionMode.Single)
              .Type(GridSelectionType.Row))
            .DataSource(dataSource => dataSource
              .Ajax()
              .ServerOperation(false))
            )

 

best regards

Danny
Top achievements
Rank 1
Iron
Veteran
Iron
 answered on 25 Nov 2020
3 answers
709 views

Good day.

I am trying to make a filter to a ListBox, but I have not gotten it to work for me, could you please help

the listBox

@(Html.Kendo().ListBox()
                  .Name("lstBuscarMenu")
                  .HtmlAttributes(new { style = "width:100%;height:700px;"})
                  .DataTextField("Nombre")
                  .TemplateId("customer-item-template")
                  .BindTo(ViewBag.Menus)
                  )

the planitlla
<script id="customer-item-template" type="text/x-kendo-template">
  <span class="k-state-default"><strong>#: data.Nombre #</strong><p style="font-size:0.6rem;">#: data.Seccion #</p></span>
</script>
the javascript
var dataSourceMenu = null;
$("#txtBuscarMenu").keyup(function(e) {
    var texto = $("#txtBuscarMenu").val();
    var grid = $("#lstBuscarMenu").data("kendoListBox");
    if (dataSourceMenu === null) {
        dataSourceMenu = grid.dataItems();
    }
    if (texto.length === 0) {
        grid.setDataSource(dataSourceMenu);
    }
    else {
        grid.setDataSource(dataSourceMenu.find(x => x.Nombre.indexOf(texto) > -1));
    }
});
best regards

Tsvetomir
Telerik team
 answered on 25 Nov 2020
3 answers
455 views

Hi,

Does telerik grid support 3rd ClientDetailTemplateId? I have the templates as below (questionTemplate (1st), questionAnswerTemplate (2nd) and surveyAnswerCommentsTemplate (3rd) ). I've the the questionTemplate and questionAnswerTemplate working. But the surveyAnswerCommentsTemplate template is not being called. I'm trying to display the Comments field in surveyAnswerCommentsTemplate , but Comments field belongs to questionAnswerTemplate.

 

<div class="aamva-center">
    @(Html.Kendo().Grid<AAMVA.Website.Survey.Models.SurveyResponseViewModel>()
        .Name("grid")
        .Scrollable(scrollable => scrollable.Height("auto"))
        .Columns(columns =>
        {
            columns.Bound(p => p.SurveyID);
            columns.Bound(p => p.FullName);
        })
        .ClientRowTemplate(
            "<tr data-uid='#: uid #' class='k-master-row' role='row'><td class='k-hierarchy-cell' aria-expanded='true'><aclass='k-icon k-i-collapse' href='\\#' aria-label='Collapse' tabindex='-1'></a></td>" +
                "<td colspan='2' style='font-size: 14px;'>" +
                      "<div ><span><b>Name :</b></span> #: FullName# </div>" +
                      "<div ><b>Contact Info/Comments :</b> #: Comments# </div>" +
                      "<div ><b>Jurisdiction :</b> #: Jurisdiction# </div>" +
                      //"<div ><b>SurveyResponseID :</b> #: SurveyResponseID# </div>" +
                "</td>" +
             "</tr>"
        )
 
        .ClientDetailTemplateId("questionTemplate")
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(1)
            .Model(model => model.Id(p => p.SurveyID))
            .Read(read => read.Action("GetSurveyResponses", "SurveyUser"))
        )
        .Scrollable()
        .Pageable(pageable => pageable
                    .Refresh(false)
                    .ButtonCount(5))
)
</div>
 
    <script id="questionTemplate" type="text/kendo-tmpl">
        <hr />
        @(Html.Kendo().Grid<AAMVA.Website.Survey.Models.SurveyQuestionViewModel>()
            .Name("grid_#=Jurisdiction#")
             .Scrollable(scrollable => scrollable.Height("auto"))
            .Columns(columns =>
            {
                columns.Bound(o => o.QuestionTextWithSortOrder).HtmlAttributes(new { style = "font-weight:bold;" });
            })
            .ClientDetailTemplateId("questionAnswerTemplate")
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model =>
                {
                    model.Id(p => p.SurveyQuestionID);
                    model.Id(p => p.SurveyQuestionTypeID);
 
                })
                .Read(read => read.Action("DetailTemplate_HierarchyBinding_GetQuestions", "SurveyUser", new { surveyID = "#=SurveyID#" }))
            )
            .ToClientTemplate()
    )
    </script>
 
 
    <script id="questionAnswerTemplate" type="text/kendo-tmpl">
 
        @(Html.Kendo().Grid<AAMVA.Website.Survey.Models.SurveyQuestionAnswerViewModel>()
            .Name("grid_#=SurveyQuestionID#")
            .Columns(columns =>
            {
                columns.Bound(o => o.Comments);//.ClientGroupHeaderTemplate("<div>Min: #= Comments #</div>");//.ClientFooterTemplate("<div>Min: #= Comments #</div>");
                columns.Bound(o => o.SelectedAnswer);
            })
            .ClientDetailTemplateId("surveyAnswerCommentsTemplate")
            //.ClientRowTemplate(Html.Partial("_DisplayAnswersForAllQuestionTypes").ToHtmlString())
            .ClientRowTemplate(
                "<tr data-uid='#: uid #' class='k-master-row' role='row' >" +
                    "\\#if( #:SurveyQuestionTypeID# == 1 ){\\#" + //yes/no
                                                                  //  "<td colspan='3'>" +
                        "<td></td><td colspan='2'>" +
                          "\\#if(  Checked == true){\\#" +
                                " <li style='list-style-type:disc; '>" +
                           "\\#}\\#" +
                           "\\#if(  Checked == false){\\#" +
                                " <li style='list-style-type:circle; '>" +
                           "\\#}\\#" +
                         "\\#: SurveyChoiceText\\# " +
                        "</td>" +
                    "\\#}\\#" +
                    "\\#if( #:SurveyQuestionTypeID# == 4 ){\\#" +  // Free text
                        "<td colspan='3'>" +
                            "<div >\\#: SelectedAnswer\\# </div>" +
 
                        "</td>" +
                    "\\#}\\#" +
                    "\\#if( #:SurveyQuestionTypeID# == 2 || #:SurveyQuestionTypeID# == 3){\\#" + //Multi Choice/Select
                        "<td></td><td colspan='2'>" +
                          //"<div > " +
                          "\\#if(  Checked == true){\\#" +
                                " <li style='list-style-type:disc; '>" +
                           "\\#}\\#" +
                           "\\#if(  Checked == false){\\#" +
                                " <li style='list-style-type:circle; '>" +
                           "\\#}\\#" +
                         "\\#: SurveyChoiceText\\# " +
                     //   "\\#: Comments\\# " +  // comments is displayed repeatedly. Wanted to display this only once so displaying in detail template surveyAnswerCommentsTemplate
 
                        //"</div>" +
                        "</td>" +
                    "\\#}\\#" +
                    "\\#if( #:SurveyQuestionTypeID# == 5){\\#" + //Ranking
                        "<td colspan='3'>" +
                         "<div >\\#: SelectedAnswer\\# </div>" +
                        "</td>" +
                    "\\#}\\#" +
                 "</tr>"
            )
            .DataSource(dataSource => dataSource
                .Ajax()
                .Model(model =>
                {
                    model.Id(p => p.SurveyQuestionID);
                    model.Id(p => p.Comments);
 
                })
                .Read(read => read.Action("DetailTemplate_HierarchyBinding_GetQuestionAnswers", "SurveyUser", new { questionID = "#=SurveyQuestionID#", surveyQuestionTypeID = "#=SurveyQuestionTypeID#" }).Data("function() { return getSurveyResponseID('grid_#=SurveyQuestionID#');}"))
            )
            .ToClientTemplate()
    )
 
    </script>
 
 
    <script id="surveyAnswerCommentsTemplate" type="text/kendo-tmpl">
 
        <hr />
 
        <div>KR</div>
        <div>#= Comments # </div> //The Comments field is in the questionAnswerTemplate and SurveyQuestionAnswerViewModel
        @* <div>\\#: Comments \\# </div>*@
    </script>
 

 

public ActionResult DetailTemplate_HierarchyBinding_GetQuestions( [DataSourceRequest] DataSourceRequest request, int surveyID)
{
    var repo = new SurveyRepository();
 
    List<SurveyQuestionViewModel> surveyQuestionsVM = GetQuestions(surveyID);
    DataSourceResult result = surveyQuestionsVM.ToDataSourceResult(request, sq => new SurveyQuestionViewModel
    {
        SortOrder = sq.SortOrder,
        SurveyQuestionID = sq.SurveyQuestionID,
        SurveyQuestionTypeID = sq.SurveyQuestionTypeID,
        SurveyID = sq.SurveyID,
        QuestionText = sq.QuestionText,
        QuestionTextWithSortOrder = sq.QuestionTextWithSortOrder
    });
    // PageSize is not set to 20 sometimes
    return Json(result);
   // return Json(surveyQuestionsVM.ToDataSourceResult(request));
}
 
public ActionResult DetailTemplate_HierarchyBinding_GetQuestionAnswers([DataSourceRequest] DataSourceRequest request, int questionID, int surveyQuestionTypeID, int surveyResponseID)
{
    var repo = new SurveyRepository();
    DataSourceResult result = null;
    // Multiple-Choice Multiple-Select and Ranking Questions
    if ((surveyQuestionTypeID == 2) || (surveyQuestionTypeID == 3))
    {
        List<SurveyQuestionAnswerViewModel> surveyQuestionAnswersVM = GetQuestionAnswers(questionID, surveyResponseID);
         
        result = surveyQuestionAnswersVM.ToDataSourceResult(request, sqa => new SurveyQuestionAnswerViewModel
        {
            SortOrder = sqa.SortOrder,
            SurveyQuestionID = sqa.SurveyQuestionID,
            SurveyChoiceText = sqa.SurveyChoiceText,
            SurveyChoiceID = sqa.SurveyChoiceID,
            Comments = sqa.Comments,
            Checked = sqa.Checked
        });
        return Json(result);
    }
    else if ( surveyQuestionTypeID == 4)  // Yes-No Questions
    {
        List<SurveyQuestionAnswerViewModel> surveyQuestionAnswerVM = GetSurveyAnswer(surveyResponseID, questionID);
        result = surveyQuestionAnswerVM.ToDataSourceResult(request, sqa => new SurveyQuestionAnswerViewModel
        {
            Comments = sqa.Comments,
            SelectedAnswer = sqa.SelectedAnswer,
            SelectedAnswerValue = sqa.SelectedAnswerValue,// has the yes/no answer choice of the response
            Checked = sqa.Checked
        });
        return Json(result);
    }else if(surveyQuestionTypeID == 1)
    {
        List<SurveyQuestionAnswerViewModel> surveyQuestionAnswerVM = GetSurveyAnswer(surveyResponseID, questionID);
 
        List<SurveyQuestionAnswerViewModel> surveyYesNoVM = new List<SurveyQuestionAnswerViewModel>();
        SurveyQuestionAnswerViewModel yesOption = new SurveyQuestionAnswerViewModel();
        yesOption.SurveyChoiceText = "Yes";
        yesOption.Checked = (surveyQuestionAnswerVM[0].SelectedAnswer.ToUpper().Equals("YES")? true: false) ;
        surveyYesNoVM.Add(yesOption);
        SurveyQuestionAnswerViewModel noOption = new SurveyQuestionAnswerViewModel();
        noOption.SurveyChoiceText = "No";
        noOption.Checked = (surveyQuestionAnswerVM[0].SelectedAnswer.ToUpper().Equals("NO") ? true : false);
        surveyYesNoVM.Add(noOption);
 
        result = surveyYesNoVM.ToDataSourceResult(request, syn => new SurveyQuestionAnswerViewModel
        {
            SurveyChoiceText = syn.SurveyChoiceText,
            Checked = syn.Checked,
            Comments = syn.Comments
        });
        return Json(result);
 
   }
    else // Free-text Questions or Ranking 
    {
        List<SurveyQuestionAnswerViewModel> surveyQuestionAnswerVM = GetSurveyAnswer(surveyResponseID, questionID);
        result = surveyQuestionAnswerVM.ToDataSourceResult(request, sqa => new SurveyQuestionAnswerViewModel
        {
            Comments = sqa.Comments,
            SelectedAnswer = sqa.SelectedAnswer,
            Checked = sqa.Checked
        });
        return Json(result);
    }
 
}

 

 

 

Thanks!

 

 

Tsvetomir
Telerik team
 answered on 24 Nov 2020
4 answers
874 views

Hello,

In my Scheduler Event the Title consists of start-end time  followed by description, new line , Adress , New Line , phone number etc.

I am using \r\n for new line but Looks like the Title does not recognize new line characters. I cannot use a fixed template as the fields and where the new line Comes is dynamic.

How can i achieve this.

 

Thanks

 

Anamika

Veselin Tsvetanov
Telerik team
 answered on 24 Nov 2020
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?