Telerik Forums
Kendo UI for jQuery Forum
4 answers
2.2K+ views

HI All,

A custom request got me spinning and wondering if any of you came across it and have a solution for me.

A NumericTextBox in the a grid column.

1. Show the exact value keyed in by the user.

    Eg. 12.12345, 23.55, 76.590

2. Value could have decimal precision up to 5 places

3. If the user enter 1.1, it should display 1.10. (showing 1 trailing 0 in the case)

I have solution to 1 and 2, but not 3.

I tried using template: "#=kendo.toString(OrderQuantity,'n2')#" for the column, It will show 2 decimal places like I wanted, but it's rounded and not what the user entered.

TIA

 

Steve
Top achievements
Rank 1
 answered on 04 Dec 2018
9 answers
175 views

I am using Asp.net core on the , in my controller I have the following code

       [HttpPost]

          public IActionResult GetUsers(string search)
        {
            var result = new List<UserDto>
            {
                new UserDto
                {
                    UserId = 1,
                    FirstName = "jhon",
                    LastName = "doe",
                    UserName = "jhond",
                    Email = "jhond@AOL.com"
                },
                new UserDto
                {
                    UserId = 2,
                    FirstName = "james",
                    LastName = "bond",
                    UserName = "jamesd",
                    Email = "jamesd@gmail.com"
                }
            };

            var data = new DataSourceResult
            {
                Total = 2,
                Data = result
            };

            return Json(data);
        }

Now my DataSourceResult object looks like this

 public class DataSourceResult<T>
    {
        /// <summary>
        /// Extra data
        /// </summary>
        public object ExtraData { get; set; }

        /// <summary>
        /// Data
        /// </summary>
        public T Data { get; set; }

        public bool Success => !Errors.Any();
        /// <summary>
        /// Errors
        /// </summary>
        public List<string> Errors { get; set; } = new List<string>();
        public Exception Exception { get; set; } 
        /// <summary>
        /// Total records
        /// </summary>
        public int Total { get; set; }
    }

    public class DataSourceResult : DataSourceResult<object>
    {

    }

My   view has this code inside

  <div id="gridUserInfo"></div>

$(document).ready(() => {

 $("#gridUserInfo").kendoGrid({
            dataSource: {
                transport: {
                    read: {
                        url: "/User/GetUsers",
                        type: "POST",
                        dataType: "json",
                        data: function() {
                            var data = {
                                search: $('#search').val()
                            };
                            return data;
                        }
                    }
                },
                schema: {
                    data: "Data",
                    total: "Total",
                    errors: "Errors",
                    model: {
                        id: "userId",
                        fields: {
                            firstName: { editable: false, type: "string" },
                            lastName: { editable: false, type: "string" },
                            userName: { editable: false, type: "string" },
                            email: { editable: false, type: "string" }
                        }
                    }
                }
            },
            height: 550,
            columns: [
                {
                    field: "firstName",
                    title: "First Name"
                },
                {
                    field: "lastName",
                    title: "Last Name"
                },
                {
                    field: "userName",
                    title: "UserName"
                },
                {
                    field: "email",
                    title: "Email"
                }
            ],
            pageable: {
                pageSizes: [10, 20, 30],
                buttonCount: 5
            }
        });

}

 

After making a POST to my UserControllerI get the following json

{"extraData":null,"data":[{"userId":1,"firstName":"jhon","lastName":"doe","email":"jhond@AOL.com","userName":"jhond"},{"userId":2,"firstName":"james","lastName":"bond","email":"jamesd@gmail.com","userName":"jamesd"}],"success":true,"errors":[],"exception":null,"total":2}

 

But it is not displaying that information on the grid, What am I doing wrong?

 

 

Eyup
Telerik team
 answered on 04 Dec 2018
1 answer
128 views

Hi,

my customer like the kendo panelbar and has a wish:

Round edge and a little space between the titles, similar to the Accordion

Do you have some css code to adapt  the appearance  of the panelbar?

Dojo with the used bootstrap v3 theme: https://dojo.telerik.com/OzeMENIY

 

Best regards,

Peter

Marin Bratanov
Telerik team
 answered on 04 Dec 2018
14 answers
1.9K+ views
Hi,

Sorry if this question is completely silly, as JavaScript is not my stronger point. I use the autocompleter to fetch cities stored in my database. What I show is the name of the city, however what I want to get when I submit my form is the id of the city, not the name. Therefore, each request returns a JSON answer with the name and the id, and I use dataTextField: "name" so that the autocompleter extracts the name. However, in some of your example (like this one : http://demos.kendoui.com/autocomplete/remotedatasource.html) you are using DataValueField, so I thought that DataValueField: "id" would work. However it doesn't. Furthermore, it appears that DataValueField is not in the documentation of available options fields (http://demos.kendoui.com/autocomplete/remotedatasource.html).
Timothy
Top achievements
Rank 1
 answered on 03 Dec 2018
4 answers
911 views

Hi all,

I try to set a default value for a numeric field. I can't figure out why it does not work.

I simply set default value this way : schema.model.fields.MyNumericField to {defaultValue : 9, type:"number"}.

All I get when I create a record is 0.

I join screenshot of entire schem model.

Thanks in advance for any help,

André.

Dimitar
Telerik team
 answered on 03 Dec 2018
1 answer
234 views
hello, i am checking to bind css to my kendo numericbox . i want to change the numeric textbox its color to red when its value is 0 . here is DOJO link: https://dojo.telerik.com/EqegiSoJ/2
Preslav
Telerik team
 answered on 03 Dec 2018
1 answer
650 views
Hello, 
             I have one kendo numeric textbox which is mvvm bind and when value is 0 its color i need to change red. but it seems to not working. Please check this link: https://dojo.telerik.com/EqegiSoJ/2
Preslav
Telerik team
 answered on 03 Dec 2018
2 answers
3.4K+ views

I know how to use dynamic columns with kendo. You just load the data before and then add columns, but I am having hard time using template with them.

 

The template function has its own scope, and when generating the values,I can't get the kendo.htmlEncode(data.fieldValue).

 

Example

https://dojo.telerik.com/ujaqoNIp

Stefan
Telerik team
 answered on 03 Dec 2018
1 answer
1.0K+ views

Hello,
         I have kendo mvvm grid which is grouped .  How can i delete item from grid easily?

Below is code to delete item from grid i found from various sources, in that 'index' gives incorrect number after grid is inserted or deleted with other items later on

var tstgrid = $(e.currentTarget).closest("[data-role='grid']").data("kendoGrid");
 $(e.target).closest("tr").trigger("click");
var index = tstgrid.items().index(tstgrid.select());
ImportPNRPricingViewModel.Tsts._data.splice(index, 1);

 

to insert we, use $.merge, 'ImportPNRPricingViewModel' is my observable and 'response' has new items

$.merge(response, ImportPNRPricingViewModel.Tsts.data());
ImportPNRPricingViewModel.Tsts.data(response);

 

 

 

Stefan
Telerik team
 answered on 03 Dec 2018
7 answers
646 views
In this demo there is a plotBand at 30000, but it's pretty meaningless without a label. Is there a way to create a tooltip/label on it?
Thanks!
Tsvetina
Telerik team
 answered on 30 Nov 2018
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?