Telerik Forums
UI for ASP.NET MVC Forum
1 answer
2.8K+ views

Hi,

I have a grid that contains this column (simplified for clarity):

columns.Bound(c => c.Status)
    .Filterable
    (
        f => f.Extra(false).Multi(true).CheckAll(true).BindTo
        (new[]
        {
                    new { Status = "New" },
                    new { Status = "Started" },
                    new { Status = "Completed" }
        })
    );

 

I want both "New" and "Started" to be checked by default when the page is first displayed.

In the DataSource, I have this code:

.DataSource
(
    .Filter
    (
        f => f
        .Add(x => x.Status).IsEqualTo("New")
    )
)

 

However, I cannot figure out how to add a second value, "Started", so that both are checked by default. How can I do this?

Thanks.

Viktor Tachev
Telerik team
 answered on 14 Nov 2017
3 answers
402 views
Has anyone had any luck with finding documentation on geolocation when using the bing layer on the kendo map UI ?  I can't seem to find any documentation.   Basically I am wanting to take advantage of the built in location services now in html 5 using mvc as my framework.
Stamo Gochev
Telerik team
 answered on 14 Nov 2017
1 answer
176 views

Hi,

I'm using

@{ var culture = System.Globalization.CultureInfo.CurrentCulture.ToString(); }
    <script src="@Url.Content("~/Scripts/cultures/kendo.culture." + culture + ".min.js")"></script>
    <script> kendo.culture("@culture")  </script>

and the most of the clients are using nl-NL as their culture and this works like I would expect but:

The official locale tells us the decimal separator is "," and thousand separator "." but everybody wants to use decimal separator "." and thousand separator ",".

Is it possible to change the kendo.culture.nl-NL.min.js file (or do I need to change kendo.culture.nl.min.js) to make this change?

 

Thanks,

Maurice Lucas


Neli
Telerik team
 answered on 13 Nov 2017
1 answer
143 views

Hi,

I have a spreadsheet in which I am populating the values using a dataset and datatable.

Once the user modifies the values in the spreadsheet, i want to pick that row and pass it to a datatable so that I can perform my update operation.

transport: {
        /* the other CRUD settings are ommitted for brevity */
        update:

 

Can you let me know how to pass the modified row to dataset or datatable using the transport method?

Veselin Tsvetanov
Telerik team
 answered on 13 Nov 2017
1 answer
151 views

Hi

I am loading a spreadsheet with the help of a dataset result. I have a stored procedure that output's the result to a dataset and this dataset is being loaded to a datatable and rendered on the speadsheet using datasource. Below is my code

public ActionResult Products_Load([DataSourceRequest]DataSourceRequest request)
        {
            DataTable dt = new DataTable();
            dt.Clear();
 
            DataSet dsGetData = HandlerUtilities.HandlerFunctions.GetDynamicSheetData(1, 4);
            if (dsGetData != null)
            {
                dt = dsGetData.Tables[0];
            }
 
            dt.Columns.Remove("atUserid");
            dt.Columns.Remove("atTimestamp");
            dt.AcceptChanges();
 
            DataSourceResult result = dt.ToDataSourceResult(request);
            JsonResult oJsonResult = Json(result, JsonRequestBehavior.AllowGet);
            return oJsonResult;
        }

 

When the data is rendered on the spreadsheet, the datetime values are getting converted into /Date(xxxxxx)/ instead of original values. I have attached the screenshot of my output for reference. My dataset is dynamic and everytime it will get changed and due to this I am not using a view model to bind the data.  Hence, I cant provide the fieldname and its format in the client side as I dont know what the fieldnames will be. Is there any workaround fr this?

Veselin Tsvetanov
Telerik team
 answered on 13 Nov 2017
3 answers
520 views

I'm building a Grid that lists a collection of data that comes from multiple sources. One of those sources is a web service so it's possible that the web service call might fail. If it does, I still want to display the data from the other sources, but I want to display a warning on the page that the web service data is not included in the results. I have a ViewModel containing this property:

public class MyVM
{
    public bool ServiceUnavailable { get; set; }
    public List<RowVM> GridData { get; set; }
}

 

So I could show the warning when the Grid first loads. However, I'm not actually going to populate GridData during the initial page load. I want the Grid to make an AJAX call to load the first page (and for any other paging.) So after each Read action completes, I need to check if ServiceUnavailable and display the warning if it is true. The problem is, the Read action only returns a List<RowVM>.ToDataSourceResult(). How can I return additional data that is separate from the Grid row data? Is there a way to override the client-side Read function to make my own AJAX call and then on success update the datasource with the returned data myself?

 

 

 

Konstantin Dikov
Telerik team
 answered on 13 Nov 2017
3 answers
566 views

Below is my autocomplete code. If I uncomment the Events section above the span class 'k-widget k-autocomplete k-header k-state-default' is removed, and the Kendo autocomplete is stoped and it is like a simple text box. Autocomplete functionality will be no more and no events are fired. Please let me know how should I fix the issue, and what may be reason for the same.

<style>

        .imgslt .k-autocomplete {
            width: 25% !important;
        }
    </style>

  

<div class="form-group imgslt">
            <label>Select Image:</label>
            <div class="demo-section k-content">
                @(Html.Kendo().AutoComplete()
          .Name("ImageNameList")
          .DataTextField("imageName")
          .Filter("contains")
          .MinLength(2)
          .HtmlAttributes(new { style = "width:100%" })
          //.Events(e => e
          //      .Select("autocomplete_select")
          //      .Change("autocomplete_change")
          //  )
          .DataSource(source =>
          {
              source.Read(read =>
              {
                  read.Action("GetListImages", "Assessment");
                  //.Data("onAdditionalData");
              })
              .ServerFiltering(false);
          })
 
                )
            </div>
 
<script>
 
     function autocomplete_select() {
                //Handle the select event.
      alert('select');
            }
 
            function autocomplete_change() {
                //Handle the change event.
    alert('change');
            }
 
</script>
Ivan Danchev
Telerik team
 answered on 13 Nov 2017
7 answers
1.5K+ views

 We have a heavy traffic data in DB, we don't want to dump huge data on to the client side and do grouping and aggregating.

So I started doing it on server side pagination, grouping and stuck with one column grouping. Need help with support multiple column grouping and then also able to aggregate data on server side.

Here is my grid Read Method

[AcceptVerbs(HttpVerbs.Post)]
       public ActionResult Read_Traffic([DataSourceRequest] DataSourceRequest request)
       {
           var results = _auditService.All(OperatingUser.CompanyId, request, out int totalRecords);
           if (request.Groups != null && request.Groups.Any())
           {
               //HaBo: Currently supporting only single grouping.
               //need to work on to support multiple groupings.
               return Json(new DataSourceResult
               {
                   Data = CustomGroupBy(results, request.Groups[0].Member),
                   Total = totalRecords
               });
           }
           //List<object> returnData = results.Cast<object>().ToList();
           //foreach (var groupDescriptor in request.Groups)
           //{
           //    returnData = (List<object>) CustomGroupBy(results, groupDescriptor.Member);
           //}
           return Json(new DataSourceResult
           {
               Data = results,
               Total = totalRecords // Total number of records
           });
       }

 

Here is my Grouping Method

private static IEnumerable<object> CustomGroupBy(List<Audit> results, string groupKey)
       {
           switch (groupKey)
           {
               case "SessionId":
                   return results.GroupBy(x => x.SessionId).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "SessionId", Subgroups = new object[] { }, Items = g });
               case "AuditId":
                   return results.GroupBy(x => x.AuditId).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "AuditId", Subgroups = new object[] { }, Items = g });
               case "UserName":
                   return results.GroupBy(x => x.UserName).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "UserName", Subgroups = new object[] { }, Items = g });
               case "IpAddress":
                   return results.GroupBy(x => x.IpAddress).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "IpAddress", Subgroups = new object[] { }, Items = g });
               case "UrlReferrer":
                   return results.GroupBy(x => x.UrlReferrer).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "UrlReferrer", Subgroups = new object[] { }, Items = g });
               case "TimeAccessed":
                   return results.GroupBy(x => x.TimeAccessed).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "TimeAccessed", Subgroups = new object[] { }, Items = g });
               case "CountryName":
                   return results.GroupBy(x => x.CountryName).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "CountryName", Subgroups = new object[] { }, Items = g });
               case "CountryCode":
                   return results.GroupBy(x => x.CountryCode).Select(g =>
                       new { Aggregates = new { }, Key = g.Key, HasSubgroups = false, Member = "CountryCode", Subgroups = new object[] { }, Items = g });
           }
           return null;
       }

 

As you can notice currently I am only able to group with the first group member, how can I support multiple column grouping?

Tsvetina
Telerik team
 answered on 10 Nov 2017
1 answer
578 views

I'm creating a dashboard. The backend database stores the type of telerik chart control should go into which box. Very simply is it even possible based on the data response to then add that telerik chart control to the corresponding div? Sample code below.

Anytime I attempt this there are javascript errors due to the HTML and javascript emitted from the toHtmlString() method.
However I see no other way to perform this based on the javascript setup.

At this point it's 100% static to determine if this is even feasible.

<script>
//pseudo code to get data from database
//now add the right control to the div

 switch(controlType) {
            case "grid":
                break;
            case "bar":
                break;
            case "pie":
                $('#widgetcontrol' + widgetId).html('@(Html.Kendo().Chart()
                  .Name("pieChart")
                  .Legend(legend => legend
                      .Position(ChartLegendPosition.Top)
                  )
                  .ChartArea(chartArea => chartArea
                      .Background("transparent")
                      .Height(250)
                  )
                  .Series(series =>
                  {
                      series.Pie(new dynamic[]
                      {
                          new {category = "Test", value = 957, color = "#9de219"},
                          new {category = "Test 2", value = 124, color = "#90cc38"},
                          new {category = "Test 3", value = 567, color = "#068c35"},
                          new {category = "Test 4", value = 678, color = "#006634"},
                    })
                        .Labels(labels => labels
                          .Template("#= category #: \n #= value# (#= kendo.format('{0:P}', percentage)#)")
                          .Background("transparent")
                          .Visible(false)
                        )
                        .StartAngle(150);
                    })
                    .Tooltip(tooltip => tooltip
                       .Visible(true)
                       .Template("#= category #: \n #= value# (#= kendo.format('{0:P}', percentage)#)")
                    ).ToHtmlString())');
                break;
            case "counter":
                break;

Stefan
Telerik team
 answered on 10 Nov 2017
1 answer
654 views

I have this property :

public string Commax_dosismaximam2 = "0,03"

 

And when it renders on the grid it become to 3.

I know is something about the culture because if I change it to "0.03" works fine, but the thing is I made it string to avoid this, I don´t understand why kendo have to convert a string to a int. 

 

Thank you

Konstantin Dikov
Telerik team
 answered on 10 Nov 2017
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
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?