Telerik Forums
Kendo UI for jQuery Forum
1 answer
139 views

Hi,

I am working with the Grid control in AngularJS and I am trying to figure out if there is a way to update all the column data with data input taken from the header template. I am using template on a column which has a textbox and header template having a textbox. As per the requirement, when the user gives an input on the header textbox all the textboxes in the column should be updated with the user input on the header.  Here is the attached plunkr where the discount column has a textbox in the header. The column data is all textboxes. When the user input a value on the header, all the column textboxes must be updated with the value.

Thank you

YK

Boyan Dimitrov
Telerik team
 answered on 15 Jun 2016
3 answers
741 views
How to add placeholder for all the filter text boxes in the grid. For date columns the filter text box should show the date format like mm\dd\yyyy. How to achieve this for all columns in the grid?
Boyan Dimitrov
Telerik team
 answered on 15 Jun 2016
3 answers
576 views

I'm having a problem with the Grid where what I'm trying to do, is have a lookup dropdownlist in one of my fields. When the user clicks the field, the dropdown does show itself with the correct items, but when I select something and tab off to the next field (or just move away from the field), it reverts back to the previously selected value, or or shows a null in the table. That being said, if I click save changes, it is actually editing the correct field in one of the tables.

My issue is, When a user clicks on a product in the productFK field, I need the selected description to stay put, yet, when I click save changes, the respective Foreign key for that product gets inserted/updated into my stored proc, and not the description field. I know this can be done, I've done it sometime last year but I haven't worked with the grid for awhile until recently and forgot how to do it.

Here's some code.

$(document).ready(function () {
    var crudServiceBaseUrl = "http://localhost:56291/",
        dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: crudServiceBaseUrl + 'Orders/GetLineItemsForOrder/' + Cookies.get("ponum"),
                    dataType: "json",
                    type: 'GET',
                    contentType: 'application/json; charset=utf-8'
                },
                create: {
                    url: crudServiceBaseUrl + 'Orders/InsertLineItems/' + Cookies.get("ponum"),
                    dataType: "json",
                    type: 'POST',
                    contentType: 'application/json; charset=utf-8',
                    complete: function (e) {
                        //ReloadLineItemGrid();
                    }
                },
                update: {
                    url: crudServiceBaseUrl + "Orders/UpdateLineItems",
                    dataType: "json",
                    type: "PUT",
                    contentType: "application/json; charset=utf-8",
                    complete: function (e) {
                        ReloadLineItemGrid();
                    }
                },
                destroy: {
                    url: crudServiceBaseUrl + 'Orders/DeleteLineItem',
                    datatype: "json",
                    type: 'DELETE',
                    contentType: 'application/json; charset=utf-8',
                    complete: function (e) {
                        //ReloadLineItemGrid();
                    }
                },
                parameterMap: function (options, operation) {
                    if (operation !== "read" && options.models) {
                        return kendo.stringify(options.models);
                    }
                }
            },
            batch: true,
            pageSize: 20,
            schema: {
                model: {
                    id: "LineItemPK",
                    fields: {
                        LineItemPK: { editable: false, type: "string", nullable: true },
                        Quantity: { editable: true, type: "number", format: "{0:d}" },
                        UnitPrice: { editable: true, type: "number", format: "{0:c2}" },
                        ExtPrice: { editable: false, type: "number", format: "{0:c2}" },
                        ProductFK: { editable: true, type: "number" },
                        ProductID: { editable: true, type: "string" },
                        UoM: { editable: true, type: "string" },
                        InvoiceNum: { editable: true, type: "string" },
                        DepFunction: { editable: true, type: "string" },
                        CostCenterFK: { editable: false, type: "number" },
                        AccountFK: { editable: false, type: "number" },
                        OrderFK: { editable: false, type: "number" }
                    }
                }
            }
        });
    $("#gridLineItems").kendoGrid({
        dataSource: dataSource,
        navigatable: true,
        pageable: true,
        editable: {
            mode: "inline"
        },
        toolbar: [{ name: "create", text: "Insert Line" }, { name: "cancel" }, { name: "save" }],
        columns: [
            { field: "LineItemPK", title: "LineItemPK", hidden: true },
            { field: "Quantity", title: "Qty", validation: { min: 0 } },
            { field: "UnitPrice", title: "Unit Price" },
            { field: "ExtPrice", title: "Ext. Price", editable: false, attributes: { "class": "ExtPrice" } },
            { field: "ProductFK", title: "Product FK", editor: productDropDownEditor, template: "#=Description#" },
            { field: "ProductID", title: "Product ID" },
            { field: "UoM", title: "UoM" },
            { field: "InvoiceNum", title: "Invoice #" },
            { field: "DepFunction", title: "Dep. Funct." },
            { field: "CostCenterFK", title: "Cost Center", hidden: false },
            { field: "AccountFK", title: "G/L" },
            { field: "OrderFK", title: "OrderFK", editable: false, hidden: true },
            { command: "destroy", title: " ", width: 120 }
        ],
        editable: true,
        selectable: true,
        edit: function(e) {
            setTimeout(function () {
                var input = e.container.find("input");
                input.select();
            }, 100);
        },
        remove: function (e) {
            dataSource.sync();
        },
        save: function (data) {
 
            if (data.values.Quantity)
            {
               
            }
        },
        saveChanges: function (data)
        {
 
        }
    });
 
});
 
function ReloadLineItemGrid()
{
    $("#gridLineItems").data("kendoGrid").dataSource.read();
    $('#gridLineItems').data('kendoGrid').refresh();
}
 
/* -- custom drop down editors */
function productDropDownEditor(container, options) {
    $('<input data-text-field="Description" data-value-field="ProductPK" data-bind="value:' + options.field + '"/>')
        .appendTo(container)
        .kendoDropDownList({
            autoBind: false,
            dataSource: {
                type: "json",
                transport: {
                    read: "http://localhost:56291/api/products"
                }
            },
            dataTextField: "Description",
            dataValueField: "ProductPK"
        });
}

 

So as you can see, I'm calling another SP to return all products and I'm targeting fields Description and ProductPK. I'm stuffing that into the editor. When the grid does a save, I'm calling another SP that saves line items for an order, and I'm throwing the ProductPK into that SP, so as I explained earlier, I need to have a integer there, but for UX sake, I need the editor to always show the selected PK/index on grid load, and I need it to stay put when the user makes a selection and changes it. I hope I'm explaining this correctly.

I realize I can probably define another method that passes in a value and returns the string, "description" value, but I'm hoping there's an easier way - I thought there was. I thought I recall doing something like this in the past by playing with this line....

$('<input data-text-field="Description" data-value-field="ProductPK" data-bind="value:' + options.field + '"/>')

 

Any help is appreciated.

Boyan Dimitrov
Telerik team
 answered on 15 Jun 2016
11 answers
2.5K+ views
Hi,
In Kendo UI Grid when navigatable is true, by right the keyboard Navigation should work base on the value of the "selectable" property. If the selectable value is "row"  then the up-arrow key should make the previous row, selected... and similarly down-arrow key should make the next row, selected! However, Kendo Grid regardless of the value of selectable property, it's always navigating over cells!

I'm not sure if it's a bug or it's the way it works!

However, this would be both logically and practically make sense for keyboard navigation to work based on the value of the "selectable" property.

Please kindly help to evaluate the above request and advise how can we achieve keyboard navigation (up and down arrows) over rows?

Thank you.

Dimiter Madjarov
Telerik team
 answered on 15 Jun 2016
1 answer
122 views

Hi Team,

am using Kendo UI grid and I have a scenario where I need to set server sorting to true if I get the total number of records >= 1000, if the number of records are less than 1000 , then the server soring should set to false. I also have dynamic columns and headers.  Here is the rough code.

If I get more than "1000" records then server sorting is set to true but it triggers the read operation again continuously? Could you please help with this scenario, please let me know if am missing anything here.

this.bindWidgetData = function () {       
        $("#" + gridId+ "").empty();
        $("#" + widgetId + "").kendoGrid({
            sortable: {allowUnsort:true},
            selectable: "Single, Cell",
            resizable: true,
            pageable: false,           
            dataBound:this.dataBound,
            change: function (e) {
                var i = 10;
            }
            //dataBinding: this.dataBinding,
        })
 setGridData();
}
  
this.setGridData = function () {
        var gridData = $("#" + this.gridid).data("kendoGrid");     
        _widgetCallParams = this.getCallParameters();
        this.UpdateSortInfo(sort);
        var dataSource = new kendo.data.DataSource({
            transport: {
                read: function (options) {                   
                    $.ajax({
                        url: getBaseURL() + "WSIHome/GetCustomListData",
                        dataType: "json", // "jsonp" is required for cross-domain requests; use "json" for same-domain requests                       
                        data: _widgetCallParams,
                        type: "POST",
                        success: function (result) {                          
                            var columns = _this.getGridColumnsHeadersandFormat(result.data);
                            gridData.setOptions({
                                columns: columns
                            });
                            gridData.dataSource.options.serverSorting = (result.rowtotal) >= _widgetCallParams.TopX ? true : false;                          
                            options.success(result);
                        },
              
            schema: {
            data: "data",
            total: "rowtotal"// twitter's response is { "results": [ /* results */ ] }
            },
           
        });
      
        gridData.setDataSource(dataSource);
    };

Daniel
Telerik team
 answered on 15 Jun 2016
6 answers
656 views

Hi,

I have 2 questions.

Q1:

I am trying to add Dropdown to gantt Chart Tollbar, Dropdown is added but it is not working.

In HTML

<div id="example">
        <div kendo-gantt k-options="ganttOptions"></div>
        <script id="template" type="text/x-kendo-template">
            <select kendo-drop-down-list
            k-data-text-field="'name'"
            k-data-value-field="'id'"
            k-data-source="productsDataSource"
            style="width: 100%"></select>
        </script>
    </div>

In Angular Controller

$scope.ganttOptions = 
        {
            toolbar: [
                            { template: kendo.template($("#template").html())}

                         ]

        }

 $scope.productsDataSource = 
        {
       transport: {
           read: {
               url: "Data/products.json",
               dataType:"json"
           }
       }
   };

Q2: 

     I want to Remove the Add Task Button at the bottom. I have used "gantt.footer.find(".k-button").css("visibility", "hidden");" , that's not working in my case may be due to angular. Can you specify a way to acheive this for angular.

 

Dimitar Terziev
Telerik team
 answered on 15 Jun 2016
1 answer
278 views

Hello,

I am trying to restrict user input of the AutoComplete but the AutoComplete is inside a Kendo UI (MVC) Grid. I successfully implemented the example showing how to restrict user input of an AutoComplete but it does not keep the value cleared when the AutoComplete is inside a Grid. This is the example that I followed: http://docs.telerik.com/kendo-ui/controls/editors/autocomplete/how-to/restrict-user-input

Can you please show me how to "Restrict User Input" for the AutoComplete that is inside a Kendo UI (MVC) Grid batch edit mode? The autocomplete is implemented setting an EditorTemplateName bound to a column.

Thanks,

Michael

Dimiter Topalov
Telerik team
 answered on 15 Jun 2016
1 answer
189 views

I printed date from datePicker that you are providing.

'6/14/2016 12:00 AM'  was result and I want to change it into 'YY/MM/DD' format.

I use Oracle DB so I tried TO_DATE(Column name, 'MM/DD/YYYY HH:MI') and it didn't work.

Is there any way to change format of your datePicker format just like as customizing templates?

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 14 Jun 2016
1 answer
269 views

Hi,

I'm building a scheduling app which would use the Scheduler component and would like to allow my users to stretch and drag and drop events on the weekly schedule.

However, they are working in 1-2 hour events through out the day, but possibly through multiple days.

On this demo:

http://demos.telerik.com/kendo-ui/scheduler/move-resize

 

It is seen that event resize works EITHER horizontal OR vertical depending on is it an all day event or not.

What I would like to do is:

- When the user clicks on an empty slot, open a popup to let him add an event slot

- When he drags it verticalit will be the length of the event in the day 1-2-4-8 hours, when he drags it horizontal it will be the number of days it spans

 

From the demos and examples I cannot find that you can make both options on the same slot...so resize in both directions.

Is it possible?

Added question...also a click on the empty space in the scheduler to add a slot?

 

Thank you!

 

 

Stefan
Telerik team
 answered on 14 Jun 2016
3 answers
371 views

Hi,

 

I'm try to localize Insert Hyperlink popup in Kendo Editor by using kendo culture, but unfortunately I can't make it.

I also couldn't see that in your demo (please see the attached screenshot).

I was wondering if you could help me with that.

 

Thanks!

Patrick | Technical Support Engineer, Senior
Telerik team
 answered on 14 Jun 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?