Telerik Forums
Kendo UI for jQuery Forum
6 answers
80 views

All... I have to change the Grid Layout on an user selection. So the grid will have different column layout and different datasource set for each User selection..
So I did the obvious chose of a Kendo Newbe ... I destroyed the previously created Kendo grid, cleared the grid inner html and recreated the kendo grid using the new column values
Everything works fine.. but after the second selection (first selection is when the kendogrid is first created) ... the grouping wont work ..

any lime light on this issue is appriciated...
Here is the code snippit..
 
<div id="grid" style="height: 380px"></div>

var ViewGridId = 'grid';
var ViewGrid = $("#" + ViewGridId).data("kendoGrid");          
if (ViewGrid) {
 ViewGrid.destroy();
 }
$("#" + ViewGridId).html('');
$("#" + ViewGridId).kendoGrid({
                    dataSource: {
                        data: DataSourceArray,
                        pageSize: 5
                    },
                    change: TryCrmView_FetchXmlMethod.ViewGrid_onChange,
                    selectable: "single",
                    groupable: true,
                    sortable: true,
                    pageable: {
                        refresh: true,
                        pageSizes: true
                    },
                    columns: ColumnsArray
                }); 

 

 

 

 

Atanas Korchev
Telerik team
 answered on 06 May 2013
1 answer
521 views
Hi,

How do you make the "open link in new window option" checked by default, or always checked?

This option is in the "insert hyperlink" dialog for the editor.

Thanks



Alex Gyoshev
Telerik team
 answered on 06 May 2013
1 answer
305 views
Is it possible to sum a column without including all rows in that column.

IE
a  2
b  3
c  2
d  8
sum = 12

but only sum up a+c+d
Nikolay Rusev
Telerik team
 answered on 06 May 2013
2 answers
116 views
I'm not sure what is the best way for my scenario, so I'll explain that first.

I have two datasources. Persons and Groups, each Person-Item has an indicator, to which group it belongs to. The persons are binded to a kendo-grid and the groups to a <ul>. My problem is, that I want to display a count-number besides the group, which indicates how many persons are in that group - this information is calculated from the persons-datasource and not part of the group itself.

Sorry for that generic question - but I'm really struggling with this...

01.var contactGroupsDataSource = new kendo.data.DataSource({
02.  transport: {
03.    read: {
04.      url: "api/contactgroups"
05.    }
06.  }
07.});
08. 
09.$('#contactGroupsList').kendoListView({
10.    dataSource: contactGroupsDataSource,
11.    template: "<li class='contactGroupListItem' data-number='${Number}'>${Number} ${Name} (<span data-bind="text: cgcount[1]"></span>) </li>"
12.});
13. 
14.viewModel = kendo.observable({
15.        contactsDataSource: new kendo.data.DataSource({
16.            transport: {
17.                read: {
18.                    url: "api/contacts"
19.                }
20.            },
21.            schema: {
22.                model: {
23.                    id: "Id",
24.                    fields: {
25.                        id: { type: "string" },
26.                        FirstName: { type: "string" },
27.                        LastName: { type: "string" },
28.                        ContactGroupNumber: { type: "integer" }
29.                    }
30.                }
31.            },
32.            change: function (e) {
33.                var data = this.data();
34. 
35.                for (var i = 0; i < data.length; i++) {
36.                    var cg = data[i]["ContactGroupNumber"];
37.                    viewModel.cgcount.splice([cg - 1], 1, viewModel.cgcount[cg - 1] + 1);
38.                }
39. 
40.                for (var i = 0; i < 7; i++) {
41.                    console.log(i + 1 + ': ' + viewModel.cgcount[i]);
42.                }
43.            }
44.        }),
45.        cgcount: new kendo.data.ObservableArray([0, 0, 0, 0, 0, 0, 0])
46.    });
47. 
48.    kendo.bind($("#contactsGroupContainer"), viewModel);
49. 
50.    contactsListView = $('#contactsList').kendoGrid({
51.        dataSource: viewModel.contactsDataSource,
52.        sortable: true,
53.        rowTemplate: kendo.template($("#rowTemplate").html())
54.    });
Daniel
Top achievements
Rank 1
 answered on 05 May 2013
1 answer
69 views
I have a kendoObservable (numeric value) that is bound both to a span (text: ) and a kendo slider (value:)

I have a button that increments the value. But only the text version is updating. What did I do wrong?

An example is worth a thousand words:

http://jsbin.com/afogaq/2/

One wrinkle here is that i need to dynamically add the slider. So there is a button at the top that you have to hit first, to add the slider to the DOM. Then just press the [increment] button to see what is going on.

(do I have to rebind the VM, after adding the slider?).
Holger
Top achievements
Rank 1
 answered on 05 May 2013
1 answer
456 views
I have an object:
public class User
{
    public int Id { get; set; }
    public string Name { get; set; }
}
And in the editor template, where model.Members are a collection of Users
@(Html.Kendo().MultiSelectFor(model => model.Members)
    .DataValueField("Id")
    .DataTextField("Name")
    .Placeholder("Type user's name...")
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("MemberRead", "Group");
        });
    }))
When posting the form containing this multiselect I get the following post data
Id:0
Name:Test
Description:Test
Members.Id:1
Members.Name:Jan
Members:[object Object]
Now as far as I can tell the post data is correct, except for"Members:[object Object]" which Kendo throws an error for. When the model is received by the controller, the Members field is null.

What settings are incorrect?

(Note that MemberRead is populating the MultiSelect correctly)

(Also note that this form is part of a popup editor of a grid, in which everything else is working correctly)
Georgi Krustev
Telerik team
 answered on 05 May 2013
4 answers
83 views
Hello,

I could use a bit of advice.

I am working with a listview that has tiered sections. I can click on each branch in the tree to drill down to the next level. It looks like this: 
$("#listview").kendoMobileListView({
    dataSource: data,
    template: kendo.template($("#exampleTemplate").html()),
    click: function (e) {
         // event to handle change in dataSource
         $("#listivew").data("kendoMobileListView").setDataSource(dataSource);
    }
});
This is working - the problem occurs if I revisit a view. If I click through the list, updating the dataSource and showing the new options, I can't go back and choose a different option. If I try, I am met with an "Uncaught TypeError: Cannot read property 'sectionId' of undefined". 

It's a category list with sub-categories underneath. If I click Shoes > Sandals > Flip-Flops everything works, but if I try to go back and change from Flip-Flops to something else, I'm met with the TypeError.

This tells me that the data isn't getting bound to the view when I go back (right?). I currently use onShow() to set up the dataSource. When using onBeforeShow() the list won't update with new data after the first time through, so going back and selecting Hiking Boots instead of Sandals will still show me the results for Sandals.

Is there another method I could use to get this data to show up correctly on subsequent passes through the list?

Thanks!
Petyo
Telerik team
 answered on 04 May 2013
5 answers
171 views
Currently I am receiving an error when accessing a Kendo Window of a partial page with a Grid inside:

SCRIPT5022: DOM Exception: NOT_FOUND_ERR (8) 
kendo.web.min.js, line 16 character 31193

l.table[0].replaceChild(r,l.tbody[0])

My window Kendo window code is as follows:

@(Html.Kendo().Window()
                    .Name("mbWindow")
                    .Width(630)
                    .Height(530)
                    .Title("Add Element")
                    .Content(
                    @<text>
                    @Html.Partial("../Controller/PartialPage")
                    </text>)
                    .Draggable()
                    .Visible(false))

My partial page is as follows:

@{
    ViewBag.Title = "Elements";
}
<h2>
    Elements</h2>
<div id="mxBWindow">
    @(Html.Kendo().Grid<Model.MB>()
            .Name("MBGrid")
                .HtmlAttributes(new { style = "height:460px;" })
            .Columns(columns =>
            {
                columns.Bound(p => p.ID);
                columns.Bound(p => p.Amount);
                columns.Bound(p => p.ParentID);
                columns.Command(command => command.Destroy()).Width(110);
            })
            .ToolBar(toolbar =>
            {
                toolbar.Create();
                toolbar.Save();
            })
            .Editable(editable => editable.Mode(GridEditMode.InCell))
            //.Pageable()
            //.Sortable()
            //.Selectable(s => s.Enabled(true))
            //.Navigatable(n => n.Enabled(true))
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                .Events(events => events.Error("error_handler"))
                .Model(model => model.Id(p => p.ID))
                        .Create("Editing_Create", "Grid")
                        .Read("Editing_Read", "Grid")
                        .Update("Editing_Update", "Grid")
                        .Destroy("Editing_Destroy", "Grid")
            )
                .Events(ev => ev.SaveChanges("submitElements"))
    )
</div>

I have noticed that when I remove this Grid from the partial page, the window gives me no errors. Both pages, however, when accessed individually give me no errors. Yet when I add the Grid back in with the Kendo Window, I get the DOM Exception.

Page w/Grid - No Errors
Page w/Window - No Errors
Page w/Window(w/Grid Inside) - Error/DOM Exception

Could someone please point me out what might be causing this error?
Louis
Top achievements
Rank 1
 answered on 03 May 2013
1 answer
107 views
Dear Kendo Team,
When i resize a column in a detail row, the detail grid has a strange expansion behavior (see file in attachment)
Could you provide a work around or something else in order to solve the issue?
Thanks in advance
Best regards
Dimo
Telerik team
 answered on 03 May 2013
1 answer
208 views
I wanted to use observable object for my grid, hoping that the performance would be better then what i was getting before.
but i am not sure if it is. I also am confused about the usage.
It seams to be pretty much the same thing.

[I use TypeScript, that's why the code looks a little bit different to pure JS]

When i add a new item.
With the old way i did something like this:
static gridItems: cGridItem[] = [];
 
gridItems.push(item);
 
var grid = $("#grid").data("kendoGrid");
grid.setDataSource(gridItems);
grid.dataSource.read();
then i changed it to observable object way like this:

// Define a DataSource
    static gDataSource = new kendo.data.DataSource({
        data: tsDataManager.gridItems
    });
 
    // Create an observable object.
    static vm = kendo.observable({
        items: tsDataManager.gDataSource
    });
 
tsDataManager.gDataSource.add(item);
Can't see any performance differences.

The weird thing is when i try to edit the items.
In the old way i did this:
var grid = $("#vmGrid").data("kendoGrid");
var item = grid.dataSource.get(id);
item.TimeStamp = tStamp;
               item.Close = aInfo.Last;
               item.Price = aInfo.Last;
               item.NetChange = aInfo.Net;
               item.AskPrice = aInfo.AskPrice;
               item.AskSize = aInfo.AskSize;
               item.BidPrice = aInfo.BidPrice;
               item.BidSize = aInfo.BidSize;
               item.TotalVolume = aInfo.Volume;
 
grid.refresh();
i expected not to have to run the grid refresh with the observable object. But it turns out i still had to do it. or it would not show any changes.
The new code loos like this:
var grid = $("#vmGrid").data("kendoGrid");
var item = tsDataManager.gDataSource.get(id);
 
item.TimeStamp = tStamp;
                item.Close = aInfo.Last;
                item.Price = aInfo.Last;
                item.NetChange = aInfo.Net;
                item.AskPrice = aInfo.AskPrice;
                item.AskSize = aInfo.AskSize;
                item.BidPrice = aInfo.BidPrice;
                item.BidSize = aInfo.BidSize;
                item.TotalVolume = aInfo.Volume;
grid.refresh();
so it's basically the same thing.
I don't get what the advantage is here, especially with the editing of the rows.

Am i using it wrong?
MAGNUS
Top achievements
Rank 1
 answered on 03 May 2013
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
Iron
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
Iron
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?