Telerik Forums
Kendo UI for jQuery Forum
1 answer
690 views
I am trying provide a custom type in the schema of the datasoure object of kendogrid. Here is my code sample.


oThis.productsDataSource = new kendo.data.DataSource
            ({
                pageSize: 10,
                transport: {
                    read: {
                        url: crudServiceBaseUrl + "GetAll",
                        dataType: "json"
                    },
                    update: {
                        url: crudServiceBaseUrl + "Post",
                        contentType: "application/json",
                        type: "POST",
                        dataType: "json"
                    },
                    destroy: {
                        url: crudServiceBaseUrl + "Delete",
                        contentType: "application/json",
                        type: "DELETE",
                        dataType: "json"
                    },
                    create: {
                        url: crudServiceBaseUrl + "New",
                        contentType: "application/json",
                        type: "POST",
                        dataType: "json"
                    },
                    parameterMap: function (data, type) {
                        if (type !== "read" && data.models) {
                            return kendo.stringify(data.models[0]);
                        }
                    }
                },
 
                schema: {
                    model: {
                        id: "Id",
                        fields: {
                            Id: { editable: false, nullable: true },
                            Name: { validation: { required: true } },
                            ResourceCostBandId: {
                                //type: "servicePath.SLF.solutionEngine.Model.EntityRef",
                                fields: {
                                    Id: { editable: false },
                                    Name: { editable: false }
                                },
                                validation: { required: true }
                            }
                        }
                    }
                },
                batch: true
            });
//type: "servicePath.SLF.solutionEngine.Model.EntityRef",
How I can specify this type while defining a schema. My "EntityRef" has two fields
id and Name which are of type strings.

var grid = this.element.kendoGrid({
            columns: [
                { field: "Name", title: "Name", width: 200, validation: { required: true } },
                {
                    // Following binding not working but when I change it to following
                    //field: "ResourceCostBandId"
                    // It works but then it set the value on the ResourceCostBandId. I want it to be set on ResourceCostBandId.Id
                    field: "ResourceCostBandId.Id", title: "Cost Band",
                    width: 200, validation: { required: true },
                    template: "#= ResourceCostBandId.Name #",
                    editor: function (container, options) {
                        $('<input required data-text-field="Name" data-value-field="Id" data-bind="value:' + options.field + '"/>')
                            .appendTo(container)
                            .kendoDropDownList({
                                dataTextField: "Name",
                                dataValueField: "Id",
                                dataSource: oThis.controller.$scope.ResourceCostBands,
                                index: 0
                            });
                    }
                },
                { command: ["edit", "destroy"], title: " ", width: "172px" }
            ],
            toolbar: ["create"],
            pageable: { "pageSize": 5, "refresh": true, "pageSizes": true },
            autoBind: true,
            dataSource: oThis.productsDataSource,
            resizable: true,
            editable: 'inline',
            selectable: true,
 
        });

Anybody have idea who I can do that.

Thanks
Alexander Popov
Telerik team
 answered on 22 May 2014
2 answers
153 views
Hello everyone:

I want to modify the default options of window to:
{
    modal     : true,
    animation : false
}
Is there a way to override the default options?

I know that we can create a new kendo plugin which extend from kendo.ui.Window to do that. But that way, we have to change all our kendo widget name, that's what we want to avoid. Any suggestions? Thanks in advance.
hustcer
Top achievements
Rank 1
 answered on 22 May 2014
1 answer
473 views
Hi Team,

Could you please help us to delete a selected row in a grid by using keyboard delete key.

Thanks
Siva
Dimiter Madjarov
Telerik team
 answered on 22 May 2014
2 answers
493 views
Hi,

Need to reorder rows in kendo mvc grid using up/down buttons and also want the order to save in db.

Please provide a sample code to acheive this.

Many Thanks
Petur Subev
Telerik team
 answered on 22 May 2014
1 answer
88 views
I have a grid with 10 columns of various widths:

columns: [{
        field: "items__item",
        title: "Item Id",
        width: 25
    }, {
        field: "items__name",
        title: "Item Name",
        width: 125
    }, {
        field: "items__average_historic_price",
        title: "Avg Hist Price",
        width: 25
    }, {
        field: "items__price_currency",
        title: "Currency",
        width: 25
    }, {
        field: "items__quantity",
        title: "Quantity",
        width: 25
    }, {
        field: "attribute79_value",
        title: "Major Customer?",
        width: 125
    }, {
        field: "attribute84_value",
        title: "Orig City",
        width: 75
    }, {
        field: "attribute85_value",
        title: "Orig State",
        width: 25
    }, {
        field: "attribute89_value",
        title: "Dest City",
        width: 75
    }, {
        field: "attribute90_value",
        title: "Dest State",
        width: 25
    }
]

The grid renders fine. I have columnMenu set to true. When I go to any column menu and deselect a checkbox in the Columns section, that column is hidden as expected but all the remaining columns shrink and collapse to the left (see attached).

This behavior does not happen if i set all columns to the same width (ex: 200).
Nikolay Rusev
Telerik team
 answered on 22 May 2014
6 answers
197 views
Hi, it is possible to set the showWorkHours option using MVVM? If is it possible which is the data-??? parameter?

Thanks in advance
Darryl
Top achievements
Rank 1
 answered on 22 May 2014
1 answer
219 views
I've created a hierarchical grid which seemed like it was working properly until I started expanding multiple rows. In the attached screen shots if I click on row 5 it works, but then when I click on row 10 the data comes back under row 5 and row 10 is empty. I can reproduce this with any combination of rows. 

The child grid is defined as follows
<script id="template" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<Ebook2Web.PricingGridSvc.PricingGridDetail >()
            .Name("PricingGridDetail_#PricingGridId#")
            .Columns(columns =>
            {
                columns.Bound(d => d.PricingGridDetailId);
                columns.Bound(d => d.StartPrice);
                columns.Bound(d => d.EndPrice);
                columns.Bound(d => d.Price);
                columns.Bound(d => d.TierId);
                columns.Bound(d => d.ModifiedBy);
                columns.Bound(d => d.ModifiedDate);     
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Read(read => read.Action("CreatePricingGridDetail", "PricingGrid", new { pricingGridId = "#=PricingGridId#" }))
            )
            .ToClientTemplate()
    )
 
</script>

and the controller method as 
public ActionResult CreatePricingGridDetail(int pricingGridId, [DataSourceRequest] DataSourceRequest request)
       {
           var pricingGrid = PricingGrids.SingleOrDefault(x => x.PricingGridId == pricingGridId);
           return Json(pricingGrid.Details.ToDataSourceResult(request));
       }
 I've attached the full files in the zip. This is my second Kendo grid and first hierarchical one so I'd appreciate any help.

Bill
wdudek
Top achievements
Rank 1
 answered on 21 May 2014
4 answers
503 views
Hi,

AFAIK the tabs can currenly only placed at the top.
Would be a nice feature to be able to position them at the left, bottom or right.

Jaap
Pani
Top achievements
Rank 1
 answered on 21 May 2014
3 answers
631 views
Hello!

I am working on grid that contains user account data.  We want to allow an administrator to change the password for a given user, however, a simple change of the password is undesirable.  We want to pop up a window to allow the change to occur.  This option should _only_ be available on the row currently being edited.  I have found that I can place a button in a column through the use of the ClientTemplate.  I chose a button over a hyperlink since I read I can enable/disable the button, and have set the button to be disabled by default.  Unfortunately, when I hook into the Edit event to call the javascript, I cannot pull the button out of the <td>

Here is the grid definition:

<div id="topGrid">
@(Html.DashboardGrid<DashBUserViewModel>(svm) //GirdName, Export Method Name, Controller Name, add new class, edit template
.Columns(columns =>
{
columns.Bound(x => x.Id).Hidden(true);
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(svm.cRUDColSize);
columns.Template(p => { }).ClientTemplate("<a onclick=OnSingleChange('#=Id#')>Assign Role</a>").Width(svm.cRUDColSize);
columns.Template(p => { }).ClientTemplate("<button class='myClass' disabled onclick=ChangePassword('#=Id#')>Change Password</button>").Width(svm.cRUDColSize);
// REMOVED FOR BREVITY
.Events(events => events.Cancel("showAdd").Edit("editRow").Save("showAdd")) // to blank out the template text to avoid issues
)
</div>


Here is the javascript method (the enable() method is undefined):

function editRow(currentRow) {
// Hide the add button to prevent weird errors
this.wrapper.find(".k-grid-add").hide();

if (currentRow.model.isNew()) {
currentRow.container.find("td:eq(2)").text("");
}

currentRow.container.find("td:eq(3)").enable();
}

Does anyone know how to get the button and set it to enabled?

Much thanks,

Andrew Giles

Dimiter Madjarov
Telerik team
 answered on 21 May 2014
1 answer
5.4K+ views
Hi, Can anyone please let me know how we can write our own function for sorting when the column header is clicked. And do we need to write two function for asc and desc? Any help appreciated!
Dimiter Madjarov
Telerik team
 answered on 21 May 2014
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
Drag and Drop
Application
Map
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
DropDownTree
ListBox
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
Styling
ColorPicker
Pager
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
Licensing
PivotGridV2
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
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?