Telerik Forums
Kendo UI for jQuery Forum
11 answers
1.1K+ views

I am evaluating Kendo UI Grid trial version to replace a third party grid control being used in one existing web forms application.
Environment : ASP.NET Web Forms Application (NOT MVC) (.NET Framework 4.5, upgraded from .NET Framework 2.0), Oracle 11g.
Browser : IE 11.
I am trying to implement Virtual scrolling with Remote data.
But it is not working. Data is only visible up to the height of the grid. Scroll bar is not appearing.
Setting
serverPaging: true,
serverSorting: true
does not show any data.

Could anyone tell me where I am going wrong ?
The server side function GetData() invokes database stored procedure which returns all data. It will not be possible to implement paging in the store procedures as there are a very large number of different grids aka stored procedures. If this is the cause of Virtual Scrolling not working, please suggest me the work around.

Sample code is as follows:

 

ManageUsers.aspx
 
<asp:Content ContentPlaceHolderID="mainContent" ID="conPort" runat="server">
     
    <link href="styles/kendo.common.min.css" rel="stylesheet" />
    <link href="styles/kendo.metro.min.css" rel="stylesheet" />
    <script src="js/jquery.min.js"></script>
    <script src="js/kendo.all.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function ()
        {
            $('#dvGrid').kendoGrid({
                scrollable: { virtual: true },
                sortable: true,
                selectable: "row",
                filterable: true,
                dataSource:
                    {
                        transport:
                            {
                                read:
                                    {
                                        url: "ManageUsers.aspx/GetData",
                                        type: "POST",
                                        contentType: "application/json; charset=utf-8",
                                        dataType: "json"
                                    }
                            },
                        schema:
                            {
                                data:
                                  function (response)
                                  {
                                      return $.parseJSON(response.d);
                                  }
                            },
                        type:"json",
                        pageSize: 10//,
                        //serverPaging: true,
                        //serverSorting: true,
                        //batch: true
                    },
                columns: [
                {field: "ID", title: "USER ID"},
                {field: "USER_NAME", title: "USER NAME"}
                ]
            });
        });
    </script>
 
    <div>
        <div id="dvGrid" class="k-widget k-grid" style="width:450px;height:350px"></div>
    </div>
 
</asp:Content>
 
////////////////////////////////////////
 
ManageUsers.aspx.cs
 
using Newtonsoft.Json;
 
[System.Web.Services.WebMethod]
        public static string GetData()
        {
            TblUser objTblUser = new TblUser();
            DataSet objDataSet = new DataSet();
            objDataSet = objTblUser.DataSetLoad("A", 0);
             
            DataView dvw = objDataSet.Tables[0].DefaultView;
            dvw.RowFilter = " USER_NAME LIKE 'E%' ";
             
            return JsonConvert.SerializeObject(dvw.ToTable());
        }
 
 
////////////////////////////
 
The converted JSon data is as follows:
 
[{"ID":2.0,"USER_NAME":"DANIEL S"},{"ID":3.0," USER _NAME":"DANIEL Z"},{"ID":6.0," USER _NAME":"DANIELS"},{"ID":19.0," USER _NAME":"DAVID"},{"ID":42.0," USER _NAME":"DEEPAK"},{"ID":48.0," USER _NAME":"DELIA"},{"ID":56.0," USER _NAME":"DEYAN"},{"ID":57.0," USER _NAME":"DHEERAJ"},{"ID":67.0," USER _NAME":"DURIAN"},{"ID":71.0," USER _NAME":"DIMITAR"},{"ID":89.0," USER _NAME":"DIMITAR Z"},{"ID":90.0," USER _NAME":"DOBROMIR"},{"ID":96.0," USER _NAME":"DUNCAN"}]

Tsvetomir
Telerik team
 answered on 01 Apr 2020
5 answers
312 views

Hello,

We have a donu chart we draw with the kendo ui vue chart and it looks good. We place it in a small html iframe as you can see in the attached screen shot.
The chart is using 100% of the (small) frame size. As you can see in the attached screen shot, it is not vertically aligned. Since the generated svg occupies 100% of the area I assume it is something in the seriesDefaults to tweak for it to be vertically centered. But I could not find how to do it. Please advise.


Thanks,

Ron.

Alex Hajigeorgieva
Telerik team
 answered on 01 Apr 2020
1 answer
166 views

Hi there,

On tab drag i want to update a field in the datasource.  But as soon as datasource sync is called an "Index of undefined" error is received.  This is the sortable section of the tabstrip:

var configureSortable = function () {
            $("#tabstrip ul.k-tabstrip-items").kendoSortable({
                filter: "li.k-item",
                axis: "x",
                container: "ul.k-tabstrip-items",
                hint: function (element) {
                    return $("<div id='hint' class='k-widget k-header k-tabstrip'><ul class='k-tabstrip-items k-reset'><li class='k-item k-state-active k-tab-on-top'>" + element.html() + "</li></ul></div>");
                },
                start: function (e) {
                    tabstrip.activateTab(e.item);
                },
                change: function (e) {
                    var tabstrip = $("#tabstrip").data("kendoTabStrip"),
                        reference = tabstrip.tabGroup.children().eq(e.newIndex);

                    if (e.oldIndex < e.newIndex) {
                        tabstrip.insertAfter(e.item, reference);
                    } else {
                        tabstrip.insertBefore(e.item, reference);
                    }
                },
                move: function(e) {
                    //NOTE: the heading element will be excluded from the
                    //collection as it does not match the filter
                    //e.preventDefault();
                    //shows the original position of the item
                    var originalPos = this.indexOf(e.item);
                    console.log("index of item", originalPos);
                    //shows the position where item will be moved to
                    var newPos = this.indexOf(this.placeholder);
                    console.log("index of placeholder", newPos);
                    //var item = tabStrip.dataSource.at(originalPos);
                    //console.log(item.id + item.pos + item.name + item.status + newPos);
                    //item.set("pos", newPos);
                    //tabStrip.dataSource.sync();
                    var tabstrip = $("#tabstrip").data("kendoTabStrip");
//this gives me a null
                    //var dataItem = tabstrip.dataSource.get(e.item.data("id"));
                    var dataItem = tabstrip.dataSource.at(originalPos);
     //i tried this as well
                    //tabstrip.dataSource.remove(dataItem);
                    //tabstrip.dataSource.insert(newPos, dataItem);
                    dataItem.set("pos", newPos);
                    tabstrip.dataSource.sync();
                }
            });
        };

Plamen
Telerik team
 answered on 01 Apr 2020
5 answers
1.9K+ views
I was wondering if there was a way to get the refresh button to show up without having paging turned on.  I have a grid with virtual scrolling, so I want paging turned off.  But I also want to have the refresh button available on the bottom-right of the grid.  It looks like the only way to allow this is to turn paging on.  Is this correct or is there another way to get the refresh button to show up?  Thanks!

Regards,
Brian
Joon-Sae
Top achievements
Rank 1
 answered on 31 Mar 2020
1 answer
150 views

I am seeing VERY strange behavior using a kendoValidtor with a listView. The listview is a table and each line looks like this:

 

<script type="text/x-kendo-tmpl" id="tmplMenuOptionsGroupRow">
  <tr>
      <td class="w-25">
          <i class="fal fa-arrows fa-2x dragHandler"></i>
      </td>
      <td class="w-50">
          <input name="optionDesc" class="form-control k-textbox k-input-lg" required validationMessage="Enter Description"
              data-bind="value: description, disabled:legacy, events:{change: editorModel.menuOptionGroup.onMenuItemOptionsGroupChange}" />
              
      </td>
      <td class="w-25 dragHide text-left">
          <input class="w-100 k-input-lg" data-role="numerictextbox"
              data-format="c"
              data-min="0"
              data-format="c2" name="optionPrice"
              data-spinners=false required validationMessage="Enter Price"
              data-bind="value:price, disabled:legacy, events:{change: editorModel.menuOptionGroup.onMenuItemOptionsGroupChange}" />
              <span class="k-invalid-msg" data-for="optionPrice"></span>
               
      </td>
       
      <td class="dragHide" >
          <button type="button" class="btn btn-danger btn-sm" data-bind="click:editorModel.menuOptionGroup.deleteOption, disabled:legacy"><i class="fal fal fa-trash-alt"></i>
          </button>
      </td>
  </tr>
</script>

 

 

As you can see the optionDesc field is a mandatory field and I have defined a validationMessage when it is empty.

However when I test it I see the following results (see 2020-03-29_1045.png)

As you can see the error message appears nexts ALL the optionDesc fields and not just the one that is missing.

So I thought I would try a different approach with the optionPrice field (also required). so I added a k-invalid-msg right next to the field in the same <tr> and <td >as the input. 

However it also behaves incorrectly and even MORE strangely. Basically the error message is displayed in the correct spot the first time. After that if any other field in another row is blank the error message is displayed in the original place and NOT next to the empty field. See image 2020-03-29_1049.png as an example. The field in row 3 is missing but the error message is showing in row 1 where it was previously missing.

Anyone have ideas/suggestions?

Alon

 

 

 

 

Ivan Danchev
Telerik team
 answered on 31 Mar 2020
1 answer
158 views

Is there a configuration setting or sample code for entering currency amounts in ATM style ?

For example

key
press  display
1      $ .1
2      $ .12
3      $ 3.12
5      $ 53.12
1      $ 153.12
2      $ 2,153.12
1      $ 12,153.12
etc...
Teya
Telerik team
 answered on 31 Mar 2020
1 answer
9.1K+ views
I am just starting to use the Telerik kendo grid so not sure if I left something out

We have an MVC project and are using razr views.  I have a Kendo grid displaying the results of a dynamic SQL query which doesn't allow for sorting or filtering.   Are these attributes inherent in the grid or am I missing something?

My grid:

@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
  columns.Bound(column.ColumnName).Groupable(true).Sortable(true).Filterable(true);
}
})
.Sortable(sortable => sortable.AllowUnsort(false))
.Scrollable()
.Filterable()
.Groupable()
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
foreach (System.Data.DataColumn column in Model.Columns)
{
if (column.ColumnName.Contains("-"))
{
column.ColumnName = column.ColumnName.Replace("-", "");
}
model.Field( column.ColumnName , column.DataType);
}
})
.Read(read => read.Action("ReadData", "Grid"))
)
)

My data source:

public ActionResult ReadData([DataSourceRequest] DataSourceRequest request, int id)
{
DataTable queryResults = QueryResults(id);
return Json(queryResults.ToDataSourceResult(request), "text/html", System.Text.Encoding.Unicode, JsonRequestBehavior.AllowGet);
}

private DataTable QueryResults(int id)

{

String queryString = (from a in _qryList where a.Id == id select a.Sql).First() ;
var dataTable = new DataTable();
try
{
var dataAdapter = new SqlDataAdapter(queryString, connection);
dataAdapter.Fill(dataTable);
}
catch (SqlException e)
{
ViewBag.TextareaHTML = "Your SQL Query is invalid.\r"+e.Message;
}
return dataTable;

}

Thanks
Sivaramakrishna Reddy
Top achievements
Rank 1
Veteran
 answered on 31 Mar 2020
1 answer
84 views

Hi,

The TypeScript definitions for the View are incomplete.

Kind Regards,

Marco

 

 

 

 

 

 

Martin
Telerik team
 answered on 31 Mar 2020
1 answer
4.4K+ views

Hi,

I am using the popup editing feature of the grid. Now I need to put some validation in. I was able to figure out how to validate the string field but can't figure out how to validate the date fields since I am usingt the DateTimePicker on the popup window (code at bottom).
I would like to validate that the days are greeater than today and that EndDate > StartDate for example.

Thanks in advance.

jennifer

var AuctionGrid = {};
  
/// class variables
AuctionGrid._id = null;
AuctionGrid._auctionDataSource = null;
  
/// <summary>Initialize the auctions grid</summary>
AuctionGrid.init = function () {
  
    // Auction Datasource
    AuctionGrid._auctionDataSource = new kendo.data.DataSource({
        transport: {
            read: {
                url: _rootUrl + "Test/GetAuctions/"
            },
            update: {
                url: _rootUrl + "Test/UpdateAuctions/",
                type: "POST"
            },
            destroy: {
                url: _rootUrl + "Test/DestroyAuction/",
                type: "POST"
            },
            create: {
                url: _rootUrl + "Test/CreateAuction/",
                type: "POST"
            },
            parameterMap: function (data, type) {
                // If update, create or destroy, then serialize the data
                // as JSON so that it can be more easily read on the server.
                if (type != "read") {
                    return { models: JSON.stringify(data.models) };
                } else {
                    return data;
                }
            }
        },
        schema: {
            model: {
                id: "AuctionID",
                fields: {
                    AuctionID: {
                        editable: false,
                        type: "number"
                    },
                    AuctionName: {
                        type: "string",
                        validation: {
                            required: { message: "An Auction Name is Required!" },
                            validateAuctionName: function (input) {
                                //alert(input.attr("data-bind"));
                                if (input.attr("data-bind") == "value:AuctionName") { // check if this is the element to validate
                                    alert(input.val().length);
                                    if (input.val().length > 10) {
                                        input.attr("data-validateAuctionName-msg", "AuctionName can only have a maximum of 10 characters.");
                                        return false;
                                    }
                                    else
                                        return true;
                                }
                                return true;
                            }
                        }
                    },
                    ShortDescription: {
                        type: "string"
                    },
                    LongDescription: {
                        type: "string"
                    },
                    StartDate: {
                        type: "date"
                    },
                    EndDate: {
                        type: "date",
                        validation: {
                            required: { message: "End Date is Required!" },
                            validateEndDate: function (input) {
                                  
                                    HOW DO I USE VALIDATION HERE - HOW DO I VALIDATE THAT END DATE > START DATE  
                            }
                        }
                    },
                    Active: { type: "boolean" }
                }
            }
        }
    });
  
  
    // Display the active auctions in a kendo grid.
    $("#AuctionGrid").kendoGrid({
        dataSource: AuctionGrid._auctionDataSource,
        scrollable: true,
        editable: "popup",
        pageSize: 6,
        edit: onEdit,
        height: 300,
        toolbar: ["create"],
        columns: [{
            field: "AuctionName",
            title: "Auction Name",
            width: "200px"
        }, {
            field: "ShortDescription",
            title: "Description",
            editor: textareaEditor
        }, {
            field: "StartDate",
            title: "Start Date",
            format: "{0:MM-dd-yyyy hh:mm tt}",
            editor: dateTimeEditor,
            width: "100px"
        }, {
            field: "EndDate",
            title: "End Date",
            format: "{0:MM-dd-yyyy hh:mm tt}",
            editor: dateTimeEditor,
            width: "100px"
        }, {
            field: "Active",
            title: "Active",
            template: "<input type=\"checkbox\" />",
            width: "80px"
        }, {
            command: ["edit", "destroy"], title: " ", width: "110px"
        }],
        groupable: false
    });
  
}
  
function onEdit(e) {
    $(e.container).parent().css({
        width: '600px',
        height: '400px'
    });
    // set maxLengths
    e.container.find("input[name=AuctionName]").attr("maxlength", 10);
}
  
function dateTimeEditor(container, options) {
  
    $('<input data-text-field="' + options.field + '" data-value-field="' + options.field + '" data-bind="value:' + options.field + '" data-format="' + options.format + '"/>')
                .appendTo(container)
                .kendoDateTimePicker({});
}
  
function textareaEditor(container, options) {
  
    $('<textarea data-bind="value:' + options.field + '" style="width:400px;" rows="4" ></textarea>')
        .appendTo(container);
}
Denitsa
Telerik team
 answered on 30 Mar 2020
1 answer
4.9K+ views

Hello,

First let me start by saying thanks for your previous help on these forums...they got me past a blocking issue and everything is working now...so there's the good news.

The bad news is that even though everything is working...there are some visual glitches that I can't figure out.  The worst of those being whenever I add a new row into my grid...on this particular example I have 2 DropDownLists for selecting the values to add in for the new row.  They function perfectly, but once I select a value and move onto the next column...the DropDownList and the selected value for it disappears...the value is still there in the new row, because when I click Save and look at the Controller Action, everything is coming across perfectly and the data is added into the database with no problems...also after I click save...the columns show the values as they should...the DropDownLists are disappearing only when adding a new row.  I've attached some pictures for reference and I'll include code snippets for my grid and dropdownlist.

 In the attached pictures...notice that the columns have the little red triangle in the upper left to note that there's a new value contained...but how when I move onto the next column the DropDownList and it's selected value are hidden...

Grid View:

@using TPOReporting
 
@{
    ViewBag.Title = "Server Switch Feature Defect Maintenance";
    Layout = null;
}
 
<script>
    function grid_error(e)
    {
        if (e.errors)
        {
            var message = "There are some errors:\n";
 
            // Create a message containing all errors.
            $.each(e.errors, function (key, value)
            {
                if ('errors' in value)
                {
                    $.each(value.errors, function ()
                    {
                        message += this + "\n";
                    });
                }
            });
 
            // Display the message
            alert(message);
 
            // Cancel the changes
            var grid = $("#ServerSwitchFeatureDefectGrid").data("kendoGrid");
            grid.cancelChanges();
        }
    }
</script>
 
<div>
    <h2>Server Switch Feature Defects</h2>
    <hr size="3" />
</div>
 
<div>
    @(Html.Kendo().Grid<ServerSwitchFeatureDefectModel>()
        .Columns(c =>
        {
            c.Bound(ssfd => ssfd.FeatureDefectID)
                .ClientTemplate("#:FeatureDefectName#")
                .EditorTemplateName("FeatureDefectDropDownListTemplate")
                .Title("Feature Defect");
            c.Bound(ssfd => ssfd.ServerSwitchTestStatusID)
                .ClientTemplate("#:ServerSwitchTestStatusName#")
                .EditorTemplateName("ServerSwitchTestStatusDropDownListTemplate")
                .Title("Server Switch Test Status");
            c.Bound(ssfd => ssfd.BugID)
                .Title("Bug ID");
            c.Bound(ssfd => ssfd.LastUpdate)
                .Title("Last Update");
            c.Command(cmd =>
            {
                cmd.Destroy();
            });
        })
        .DataSource(ds => ds
            .Ajax()
            .Create(c => c.Action("AddServerSwitchFeatureDefect", "ServerSwitchFeatureDefect"))
            .Destroy(d => d.Action("RemoveServerSwitchFeatureDefect", "ServerSwitchFeatureDefect"))
            .Events(e => e.Error("grid_error"))
            .Model(m =>
            {
                m.Id(s => s.ID);
                m.Field(s => s.ID).Editable(false);
            })
            .Read(r => r.Action("GetServerSwitchFeatureDefects", "ServerSwitchFeatureDefect"))
            .Update(u => u.Action("UpdateServerSwitchFeatureDefect", "ServerSwitchFeatureDefect")))
        .Editable(e => e.Mode(GridEditMode.InCell))
        .HtmlAttributes(new { style = "height:300px;" })
        .Name("ServerSwitchFeatureDefectGrid")
        .Scrollable()
        .Selectable()
        .Sortable()
        .ToolBar(t =>
        {
            t.Create();
            t.Save();
        }))
</div>

FeatureDefectDropDownListTemplate:

@using TPOReporting
 
@(Html.Kendo().DropDownListFor(m => m)
    .DataSource(ds =>
    {
        ds.Custom()
            .Type("aspnetmvc-ajax")
            .Transport(t =>
            {
                t.Read("GetFeatureDefects", "FeatureDefect");
            })
            .Schema(s =>
            {
                s.Data("Data")
                    .Total("Total");
            });
    })
    .DataTextField("Name")
    .DataValueField("ID")
    .Name("FeatureDefectID")
    .OptionLabel("Select Feature Defect..."))

 

ServerSwitchTestStatusDropDownListTemplate:

@using TPOReporting
 
@(Html.Kendo().DropDownListFor(m => m)
    .DataSource(ds =>
    {
        ds.Custom()
            .Type("aspnetmvc-ajax")
            .Transport(t =>
            {
                t.Read("GetServerSwitchTestStatus", "ServerSwitchTestStatus");
            })
            .Schema(s =>
            {
                s.Data("Data")
                    .Total("Total");
            });
    })
    .DataTextField("DisplayName")
    .DataValueField("ID")
    .Name("ServerSwitchTestStatusID")
    .OptionLabel("Select Server Switch Test Status..."))

 

The controllers are all working perfectly so I don't think I need to include those source files, but I will gladly do it if requested. They all pass back Model objects as Json via ActionResults. Pretty standard stuff.

Alex Hajigeorgieva
Telerik team
 answered on 30 Mar 2020
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
MultiColumnComboBox
Dialog
Chat
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?