Telerik Forums
Kendo UI for jQuery Forum
1 answer
220 views
What I am trying to achieve is a row template(Each row might have 20+ fields).
It needs be one row a page and I need NEXT and PREVIOUS to see other records.
I am trying to achieve this using the row template and here s my code

If I add pagable() it wont render the template rows itself. 
Also it woyld be great if u can help me on making an inline edit in this.

@(Html.Kendo().Grid<CatagoryViewModel>()
    .Name("grid")
    .HtmlAttributes(new { style = "width: 750px;height:430px;" })
    .Columns(columns =>
    {
        columns.Template(e => { }).ClientTemplate(" ").Width(140).Title("Catagory Details");
    }).Pageable()
    .ClientRowTemplate(
        "<tr data-uid='#: CatagoryId #'>" +
            "<td class='details'>" +
                "<span >#: CatagoryName #</span>" +
                "<span >#: Catagorydescription #</span>" +
            "</td>" +         
         "</tr>"
    )
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("GetAllCatagory", "Home")
    )
))




Daniel
Telerik team
 answered on 10 Feb 2015
3 answers
483 views
Hi folks!
For 'continuities sake', I need to customize the Grid pageable: options - do I need to edit the js library itself to modify the layout (I REALLY don't want to have to do that..), or is there a method to modifying the pageable template?

Currently, the kendo ui pagination is:

go to first page / go to the previous page / page numbers / go to next page / go to last page

we just want a single 'previous' button and a single 'next' button, with text labels instead of glyphs.. 

previous / page numbers / next

Thank you!
Dimiter Madjarov
Telerik team
 answered on 10 Feb 2015
2 answers
649 views
I have a pretty basic grid which displays and modifies a Javascript array, locally. However, whenever I press the "Edit" command button (Editable is defined as inline), the entire view of the grid will clear - no rows will be displayed. The array will still hold the data, though, so if I 'refresh' the grid by reapplying the datasource, it works just fine. The weirdest part is that this only happens the first time! So I'll add a few rows, click the edit button, refresh the grid, click the edit button again - now it works normally!

At first I thought it might be the issue like when cancelling an edit removes the row, due to not setting an ID on the datasource model. I do have an ID set, though.

I have now tracked the issue down to the following piece of code, inside my Grid_Edit event:
01.function Grid_Edit(e) {
02.    // Return saves the row
03.    grid.tbody.find("input").on("keydown", function (key) {
04.        if (key.which === 13) {
05.            setTimeout(function () {
06.                grid.saveRow();
07.            }, 100);
08.        }
09.    });
10. 
11.    // Escape cancels the row
12.    grid.tbody.find("input").on("keydown", function (key) {
13.        if (key.which === 27) {
14.            setTimeout(function () {
15.                grid.cancelRow();
16.            }, 100);
17.        }
18.    });
19. 
20.    // Pressing TAB (excluding Shift + TAB) on the Quantity field also saves the row
21.    grid.tbody.find("input[name=Quantity]").on("keydown", function (key) {
22.        if (!key.shiftKey && key.which === 9) {
23.            setTimeout(function () {
24.                grid.saveRow();
25.            }, 100);
26.        }
27.    });
28.}


My grid:
01.BatchCodes = [
02.    { URID: 900000, Code: "ABC123TEST", Quantity: 50 },
03.    { URID: 900001, Code: "ABC124TEST", Quantity: 25 },
04.    { URID: 900002, Code: "ABC125TEST", Quantity: 15 },
05.    { URID: 900003, Code: "ABC126TEST", Quantity: 5 }
06.];
07. 
08.$("#GridBatchCodes").kendoGrid({
09.    dataSource: {
10.        data: BatchCodes,
11.        schema: {
12.            model: {
13.                id: "URID",
14.                fields: {
15.                    URID: { type: "number" },
16.                    Code: { type: "string" },
17.                    Quantity: { type: "number" }
18.                }
19.            }
20.        }
21.    },
22.    edit: Grid_Edit,
23.    save: Grid_Save,
24.    columns: [
25.        { field: "URID", hidden: true },
26.        { field: "Code", title: "#" },
27.        { field: "Quantity", title: "Quantity" },
28.        { command: ["edit", "destroy"], width: "94px" }],
29.    toolbar: [{ name: "create" }],
30.    editable: "inline"
31.});
32. 
33.function Grid_Refresh() {
34.    var grid = $("#GridBatchCodes").data("kendoGrid");
35. 
36.    grid.cancelRow();
37.    grid.dataSource.data(BatchCodes);
38.}

The Grid_Save event shouldn't be too relevant, so I left it out. All it basically does is check if the URID > 0, in which case it will try to update the existing entry in the array. If it is 0, it pushes a new entry onto the array and refreshes the grid.

The Grid_Refresh method simply re-sets the datasource's data array.

Another weird thing is that I have a similar grid which is 'linked' to the first one. Whenever I select a row in the first grid, the second one displays a filtered list from another array. If I keep the keydown handlers on the first grid, both grids will misbehave. If I remove the keydown handlers only from the first grid, both grids will behave nicely (even though the second grid has its own keydown handlers bound!).
Nikolay Rusev
Telerik team
 answered on 10 Feb 2015
1 answer
161 views
We have 1 scheduler where multiple users can create tasks.
In the database a task is created with a user_id. So we know which user created which task.
The user_id from the database is included in JSON and Kendo UI datasource.

How we achieve that a user can only modify(update, delete) his own tasks ? Tasks from other users have to be read-only.
The popup-window must open for all, but alle buttons must be disabled if not created by the user.

thx,
Gert
Gert
Top achievements
Rank 1
 answered on 10 Feb 2015
10 answers
123 views
Hello,

I'm using an external button to start row editing. When a row is selected and I click the button, the popup editor will be displayed. Clicking "Cancel" the popup editor closes but the selected row will be removed. Whay?

I have created an example: http://dojo.telerik.com/@ralf.d-velop/orIme

What's wrong?

Regards,
Ralf
Ralf
Top achievements
Rank 1
 answered on 10 Feb 2015
3 answers
637 views
On click of delete/update it is calling create method.
Not able to figure out the problem. need help on this issue.

(function ($) {

    // Update API url
    var UPDATEUSER_API_URL = 'api/UserManagement/PostUpdateUser';
    // Delete API url
    var DELETEUSER_API_URL = 'api/UserManagement/DeleteUser';
    // Search API url
    var GETUSER_API_URL = 'api/UserManagement/GetUser';
    // Search By Id API url
    var GETUSERBYID_API_URL = 'api/UserManagement/GetUserById';


    $(function () {
        debugger;
            dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: GETUSER_API_URL,
                        dataType: "json"
                    },
                    update: {
                        url: UPDATEUSER_API_URL,
                        contentType: 'application/json;charset=utf-8',
                        dataType: "json",
                        type: "PUT"
                    },
                    destroy: {
                        url: DELETEUSER_API_URL,
                        contentType: 'application/json;charset=utf-8',
                        type: "DELETE",
                        dataType: "json",
                    },
                    create: {
                        url: UPDATEUSER_API_URL,
                        dataType: "json",
                        type: "POST",


                    },
                    parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            return { models: kendo.stringify(options.models) };
                        }
                    }
                },
                batch: true,
                pageSize: 10,
                schema: {
                    model: {
                        id: "UserProfileID",
                        fields: {
                            UserProfileId: { validation: { required: false } },
                            Password: {type: "string", validation: { required: true } },
                            Username: { editable: true, validation: { required: true } },
                            FirstName: {type: "string", validation: { required: true } },
                            LastName: {type: "string", validation: { required: true } },
                            EmailId: {type: "string", nullable: false, validation: { required: true } },
                            IsSuperUser: { type: "boolean", validation: { required: false } },
                            RoleName: {nullable: false, validation: { required: true } },
                        }
                    }
                }
            }); 
Ryan
Top achievements
Rank 1
 answered on 09 Feb 2015
2 answers
83 views
Hi team, I am looking into what I can do with the cell templates in the Kendo grid. So I can see that I can use the. I am using a kendoComboBox as the edit template, and I am using a function (comboDisplayTemplate) for the cell when it is in non edit mode, as shown below (complete example attached)...

columns: [
       { field: "ProductName", title: "Product Name" },
       { field: "Category", title: "Category", width: "180px",
          editor: categoryDropDownEditor,        
          template: comboDisplayTemplate
       },
       { field: "UnitPrice", title: "Unit Price", format: "{0:c}", width: "130px" },
       { command: "destroy", title: " ", width: "150px" }
     ],
 
function comboDisplayTemplate(data){
       return '<div style="color: blue">' +  data.Category.description + '</div>';
   }
 
   function categoryDropDownEditor(container, options) {
     var input = $('<input name="' + options.field + '"/>');
     input.appendTo(container);
     input.attr("name", options.field);
     var combo = input.kendoComboBox({
       autoBind: true,
       filter: "contains",
       placeholder: "select...",
       suggest: true,
       dataSource: combo2Data,
 
       dataTextField: "description",
       dataValueField: "code"
     });

So the "display template" (ie the non edit template) returns some html which includes the cell value.

What I would like to be able to do, is have the kendoComboBox shown in the cell when in non edit mode, that way a user can 
1. See that this cell is editable (other cells may not be - though could get around this by coloring the cells)
2. Most importantly - using the mouse the user can use one click to go to a cell and open the already display combo box, as opposed to having to first put the cell into edit mode, and then select from the drop down (2 clicks instead of one)

Is there some way of doing this?

Thanks in advance for any help / suggestions
Vladimir Iliev
Telerik team
 answered on 09 Feb 2015
2 answers
207 views
Hi,

I am trying to set the name for multiple series on the legend of the chart, but I do not want to set them via code, I want to retreive it from the server side.
My .aspx code is:

 <div id="divChart">
        <% 
            Html.Kendo().Chart<SmartClient.datamodel.publicLightingOptimization>()
            .Name("chart")
            .CategoryAxis(axis => axis.Labels(l => l.Rotation(90)).Type(ChartCategoryAxisType.Date).Date().MajorGridLines(lines => lines.Visible(true)).BaseUnit(ChartAxisBaseUnit.Minutes).BaseUnitStep(60).MinorGridLines(lines => lines.Visible(false)))
            .Tooltip(tooltip => tooltip.Visible(true))
            .Series(s => s.Line("command0", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("command1", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("command2", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("command3", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("command4", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("energy_consumption", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("energy_cost", "instant").Style(ChartLineStyle.Step))
            .Series(s => s.Line("qos", "instant").Style(ChartLineStyle.Step))
            .Legend(l => l.Position(Kendo.Mvc.UI.ChartLegendPosition.Bottom))
            .DataSource(ds => ds.Read(read =>  read.Action("GetPLValues", "Optimizations").Type(HttpVerbs.Get)))
            .Render();  
        %>
    </div>

How can I set those names from the server side code?

Thank you in advance


Etra
Top achievements
Rank 1
 answered on 09 Feb 2015
3 answers
132 views
Hello,

After updating to v2014.1.423 I'm experiencing a layout problem with the DropDownList widget and the latest Google Chrome version (34.0.1847.131 m). In IE and Firefox it's working fine.

Please have a look into the attached screenshot and demo files.

Thanks,
Holger
Georgi Krustev
Telerik team
 answered on 09 Feb 2015
2 answers
112 views
I just noticed to element property in the kendo Grid object.  This property is also present in many other Kendo widgets and it seems to be pointing at the jquery element used.

As this property isn't documented, can you confirm what's its purpose and if it officially supported by Kendo?

Regards,

Simon

Alexander Valchev
Telerik team
 answered on 09 Feb 2015
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?