Telerik Forums
Kendo UI for jQuery Forum
1 answer
2.2K+ views

Hi,

We have recently changed some legacy code which was calling a WCF API to populate the grid and it was using serverside paging. We have to use the same serverside paging but with C# datasource. How can we achieve this?

This is how the code was before when it used an API:
dataSource: {
    type: "odata",
    transport: {
        read: dataUrl,
        dataType: "json"
    },
    schema: {
        model: BillingModel,
        data: function (data) {
            return data["value"];
        },
        total: function (data) { return data['odata.count']; }
    },
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true,
    sort: { field: "EncounterDate", dir: "asc" }
}

This was changed to use the c# datasource now:

dataSource: {
    schema: {
        model: BillingModel,
    }
}

Anton Mironov
Telerik team
 answered on 11 Dec 2020
7 answers
4.5K+ views
Hello Forum:

I have a Kendo UI button in a header of a layout, and I would like to hide it using jQuery:

$("#option-button").css('display', 'none');

But the button doesnt hide, is there any way to hide it using a specific function in Kendo UI?

I will appreciate any help.

Thanks!
Nithya
Top achievements
Rank 1
 answered on 10 Dec 2020
4 answers
199 views
I am having hard time implementing server side pagination using Kendo UI Grid. I have a POST route `/worklist` that does return results when I supply params to it but I am unable to use it using the Kendo UI grid, I have searched a lot online but I cant find anything useful. Here is the result that is returned by the URL when I use Postman to supply params to it. 

    {"header":{"cursor":{"pageable":{"sort":null,"offset":0,"pageSize":5,"pageNumber":0},"page":0,"size":5,"numberOfElements":5,"totalElements":26315,"totalPages":5263},"filter":{"dobFrom":null,"dobTo":null,"inFacility":null,"inICURoom":null,"isICUBaby":null,"hasDocumentWaitingApproval":null,"hasNotification":null,"statusInfoCompleted":false,"statusToBeScreened":false,"statusConsentRequired":false,"statusSecondScreeningDateRequired":false,"statusSecondScreeningDateGiven":false,"statusAppointmentDateRequired":false,"statusAppointmentDateGiven":false,"statusReferredToENT":false,"statusFirstHourOfRehabGiven":false,"statusHaRecommended":false,"riskFactorCode":null,"facilityFollowingPatient":true,"readyToBeScreened":false,"restrictToMyPatientList":false}},"rows":[{"patientId":43101,"patientName":"LAUZON, FLORENCE","sex":"F","statusIcon":"KARAN_ICON","birthDate":"2014-07-22","decesedDate":null,"ramq":"LAUF14572215","mrn":"3009796","mrnFacilityCode":"CHUSJ","followUpFacilityCode":"CHUSJ","location":null,"age":"6 ans 4 mois","motherMaidenName":null,"phoneNumber":"(514)260-8227","address":"1425 RUE UNION","city":"SAINTE-CATHERINE","postalCode":"J5C 1G8","status":"Réussite - fin du PQDSN","statusDate":"2014-08-12"},{"patientId":43102,"patientName":"BETOURNAY, KEITH","sex":"M","statusIcon":"KARAN_ICON","birthDate":"2014-08-18","decesedDate":null,"ramq":"BETK14081812","mrn":"3010677","mrnFacilityCode":"CHUSJ","followUpFacilityCode":"CHUSJ","location":null,"age":"6 ans 3 mois","motherMaidenName":null,"phoneNumber":"(514)451-7657","address":"1735 RANG DUMAS","city":"ORMSTOWN","postalCode":"J0S 1K0","status":"Réussite - fin du PQDSN","statusDate":"2014-08-24"},{"patientId":43103,"patientName":"BETOURNAY, MARLY","sex":"F","statusIcon":"KARAN_ICON","birthDate":"2014-08-18","decesedDate":null,"ramq":"BETM14581814","mrn":"3010678","mrnFacilityCode":"CHUSJ","followUpFacilityCode":"CHUSJ","location":null,"age":"6 ans 3 mois","motherMaidenName":null,"phoneNumber":"(514)451-7657","address":"1735 RANG DUMAS","city":"ORMSTOWN","postalCode":"J0S 1K0","status":"Réussite – surveillance en audiologie recommandée","statusDate":"2014-09-04"},{"patientId":43104,"patientName":"CLIMACO-DOS SANTOS, MATHEO","sex":"M","statusIcon":"KARAN_ICON","birthDate":"2014-07-21","decesedDate":"2015-03-24","ramq":"CLIM14072117","mrn":"3011417","mrnFacilityCode":"CHUSJ","followUpFacilityCode":"CHUSJ","location":null,"age":"6 ans 4 mois","motherMaidenName":null,"phoneNumber":"(438)403-2806","address":"1448, RUE TARDIVEL","city":"LAVAL","postalCode":"H7K 0C2","status":"Décédé","statusDate":"2015-03-24"},{"patientId":43105,"patientName":"CHAGNON, BB DE SINDY","sex":"F","statusIcon":"KARAN_ICON","birthDate":"2014-08-04","decesedDate":null,"ramq":null,"mrn":"3011180","mrnFacilityCode":"CHUSJ","followUpFacilityCode":"CHUSJ","location":null,"age":"6 ans 4 mois","motherMaidenName":null,"phoneNumber":"(450)793-2578","address":"72 DION","city":"SAINT-LIBOIRE","postalCode":"J0H 1R0","status":"Réussite – surveillance en audiologie recommandée","statusDate":"2014-09-04"}]}
This is the result when explicitly mention that I need the first five results , how can I display this through kendo UI Grid, I am using the `pageSize` and the `total` records variable but no luck. 
Here is my jQuery Kendo UI code

    $('#grid').kendoGrid({
            dataSource: {
                transport: {
                    read: function (options) {
                       $.ajax({
                           type: "POST",
                           contentType: "application/json",
                           url: "worklist",
                           dataType: 'json',
                           cache: false
                       })
                    }
                },
                serverPaging: true,
                timeout: 600000,
                pageSize: 10,
            },
            schema: {
                total: '26315',
                model: {
                    fields: {
                        patientName: { type: 'string'},
                        birthDate: { type: 'string'},
                        phoneNumber: { type: 'string'},
                        ramq: { type: 'string'},
                        address: { type: 'string'},
                        mrn: { type: 'string'}
                    }
                }
            },
            height: 550,
            filterable: true,
            sortable: true,
            pageable: true,
            columns: [
                {
                    field: "patientName",
                    title: 'Patient name'
                },
                {
                    field: "birthDate",
                    title: 'BirthDate'
                },
                {
                    field:"ramq",
                    title:"RAMQ"
                },
                {
                    field:"address",
                    title: "Address"
                },
                {
                    field:"mrn",
                    title: "MRN"
                }]
        });

    });

using this, in my network tab I keep getting a 404 Not found, apparently the library is not supplying any params to the request, however I do see the empty Kendo UI grid being displayed on the page.Thanks for the help
Anton Mironov
Telerik team
 answered on 10 Dec 2020
5 answers
1.9K+ views

I am using the following JSON data in my Kendo ListView DataSource:

[
  {
    "Id": 2,
    "Name": "My Name",
    "Address": "123 Sesame Street",
    "City": "My City",
    "State": "MO",
    "ProductTypes": [
      {
        "Id": 2,
        "Name": "Cage Free"
      },
      {
        "Id": 3,
        "Name": "Free-Trade"
      },
      {
        "Id": 4,
        "Name": "GAP"
      },
      {
        "Id": 6,
        "Name": "Grass Fed"
      }
    ]
  }
]

 

Now here is my goal/issue. I would like to filter the datasource when a checkbox is checked and the field I would like to filter by is the `ProductTypes.Name` field.

However, I'm not sure how to get this working correctly.

Here is my DataSource:

profileDataSource: new kendo.data.DataSource({
    transport: {
        read: {
            url: "/Profile/GetAllProfiles",
            dataType: "json"
        }
    },
    schema: {
        model: {
            fields: {
                Id: { type: "number", editable: false, nullable: true },
                Name: { type: "string" },
                ProductTypes_Name: { type: "string", from: "ProductTypes.Name" }
            }
        }
    }
})

 

And here is how I'm currently trying to filter but it's not working:

$("#profileCertificationsListView").on("click", "input[type=checkbox]", function() {
    viewModel.profileDataSource.filter({
        filters: [
            { field: "ProductTypes_Name", operator: "eq", value: $(this).attr("name") }
        ]
    }
});

 

If I check the checkbox that has the name "Cage Free" for example, all of the items in the listview are hidden.

Misho
Telerik team
 answered on 10 Dec 2020
5 answers
361 views
I have a grid that has a few column templates defined.  Some are using data-bind="click: clickHandler" and some have custom and kendo widgets within them.  When I use a DataSource making a remote data call, it seems like the kendo.bind() is not being applied to the rows in the column.

JS Fiddle example here which has an "Action" column with a simple data-bind click handler that will not fire:
http://jsfiddle.net/jeastburn/VgtDM/

I found I can call kendo.bind() on the dataBound Grid event, but this feels like a hack and I lose the ability to have data-bind events pass the row data rather than my top-level Observable object I use in the bind() call..
Ivan Danchev
Telerik team
 answered on 10 Dec 2020
3 answers
202 views

I'm totally new to Telerik and the example that I want to build upon is defined in this style:

        <kendo-grid name="grid" height="550">
            <columns>
                <column field="Facility_Id" title="Facility"/>
                <column field="Name" title="Name"/>

when I look for hints on what is possible, I find only this style:

        $(document).ready(function () {
            var grid = $("#grid").kendoGrid({
                columns: [
                    { field: "FirstName", title: "First Name", width: "140px" },
                    { field: "LastName", title: "Last Name", width: "140px" },
                    { field: "Title" },
                    { command: { text: "View Details", click: showDetails }, title: " ", width: "180px" }]
            }).data("kendoGrid");

 

Which is the preferred one and where do I find examples for the first style please?

Thanks

Aleksandar
Telerik team
 answered on 10 Dec 2020
3 answers
196 views
I have the following:

@(Html.Kendo().ListView<CourseServiceModel.CourseSearchResult>(Model)
       .Name("CourseListView")
       .TagName("div")
       .ClientTemplateId("template")
       .DataSource(dataSource =>
       {
       dataSource.Read(read => read.Action("GetSearchedCourses", "SearchCourse").Data("getSortBy"));
       dataSource.PageSize(10);
   })
       .Pageable(x => x.PageSizes(true).Refresh(true).Info(true).PageSizes(new int[]{10,25,50}))
     )

On the first time the page loads, the datasource is read as expected. On subsequent post the datasource does not get read, no ajax calls.

Works fine in FF and Chrome only an issue in IE (8,9).

Sounds like a caching issue but not sure where to start....

The page navigation is <page to set search criteria> -> RedirectToRoute("Results") -> <Results (contains ListView)> 


Stuart
Top achievements
Rank 1
 answered on 10 Dec 2020
3 answers
468 views

I have been doing a static code analysis of my entire project with the KIUWAN tool

This tool has found some security issues in some Kendo JS files

I would like to know if they are false positives or if it can be justified in some way that there are no security problems

Problems found (the most important are the first 3):

  • Do not update control vars in 'for' loop body Maintainability Control flow
  • Potential denial-of-service attack through malicious regular expression(ReDoS)
  • Never use JavaScript 'history' object or navigation-based positioning
  • Avoid unused local variable 
  • Avoid accessing unreliable variable properties 
  • Standard pseudo-random number generators cannot withstand cryptographic attacks

    The details of the analysis are in the attached file (a zip with a pdf file)

Kendo version: 2020.2.513

 

Francisco
Top achievements
Rank 1
 answered on 10 Dec 2020
1 answer
194 views

Hi, we need to use the setOptions function when we resize the window, to set the new gantt height.

We also use the "resizable" property.

The problem is, after a "column resize", the inner "option" column width is not set to the object.

So, when we use setOptions, the columns size are back to original.

We found a workaround, where we edit the inner option column size property after a "colunnResize" event, but I think that it's a bug and it should be done by the component itself automatically.

https://dojo.telerik.com/@foxontherock/uCulUjiy/6

I also tried to keep the "listWidth" by binding the "resize" event of the inner splitbar, but I think it's not a kendo splitter, but a custom spliter made just for the gantt, and it doesn't work.

Nencho
Telerik team
 answered on 09 Dec 2020
6 answers
217 views

We’re using the Kendo Grid and need to  make it  ADA compliant . We're using a tool called JAWS for verifying the ADA compliance.
Below are some of the issues we noticed:

1) How can we set focus on the Edit popup screen from kendo grid?

2) Say once the focus is set on Edit popup form ;How can we navigate to the other controls on the popup screen ?

3) How can we exit out of the edit popup screen and set focus back to the main grid ?  

 

Thanks,

Prasuna

Angel Petrov
Telerik team
 answered on 09 Dec 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
Chat
DateRangePicker
Dialog
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
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?