Telerik Forums
Kendo UI for jQuery Forum
1 answer
65 views
Hi All,

I have got a strange one here.  If I have this template assigned to a field on grid it works fine for existing items, but if I create an item the #Id# is zero.  I have check to make sure the datasource is updated after the item is saved and the Id is set to the new value.

{ field: "Name", title: "Name", width: "300px", "template": "<div class=\"sv-navcolumn\" data-id=\"accountdetail/#:Id#\" onclick=\"accountLaunchDetails(this)\" ><span class=\"sv-navcolumnlink\" >#: Name #<img src=\"/Images/arrow-right.png\" alt=\"Show Pointer\"></span></div>"}, 

Here is the resulting HTML

<div class="sv-navcolumn" data-id="accountdetail/0" onclick="accountLaunchDetails(this)"><span class="sv-navcolumnlink">test <img src="/Images/arrow-right.png" alt="Show Pointer"></span></div>

So when is the template evaluated when an item is created?  

Any  suggesting?

Regards

Richard....



Richard
Top achievements
Rank 1
 answered on 28 Jul 2013
2 answers
165 views
Hey all,
Some odd behavior happening when I try to filter the datasource for a grid.  Using the repro code below:

<!doctype html>
<html>
<head id="head" runat="server">
    <title></title>
      <link href="styles/kendo.common.min.css" rel="stylesheet" />
    <link href="styles/kendo.default.min.css" rel="stylesheet" />
    <script src="js/jquery.min.js"></script>
    <script src="js/kendo.all.min.js"></script>
        <script type="text/javascript">
            var ds;
            $(document).ready(function () {
                var peopleData = JSON.parse($("#gridData")[0].innerHTML);
                ds = new kendo.data.DataSource({ data: peopleData, pageSize: 5 });
                bindData();            
            });
            function bindData(filter) {
                if (filter)
                    ds.filter({
                        field: "SearchableText",
                        operator: "contains",
                        value: filter
                    });
                $("#Grid").kendoGrid({
                    columns: [{ field: "FullName", title: "Name" },
                                        { field: "Phone", title: "Phone" },
                                        { field: "Email", title: "Email" }],
                    dataSource: ds,
                    detailTemplate: kendo.template($("#detailTemplate").html())
                });
            }
            function dataSearch(inText) {      
                if (inText.length < 3)
                    bindData();
                else
                    bindData(inText.toLowerCase());
            }
        </script>  
</head>
<body>
  <form runat="server">
            Search: <input onkeyup="dataSearch(this.value)" type="text" />
            <div style="width:400px" id="Grid"></div>
            <script type="text/x-kendo-template" id="detailTemplate">
                    #= Details # 
            </script>
            <div style="display:none" id="gridData" runat="server">
                [
                    {"Phone":"1","Email":"A","Fax":"F","FullName":"Adam","SearchableText":"adam","Details":"det1"},
                    {"Phone":"1","Email":"A","Fax":"F","FullName":"Bob","SearchableText":"bob","Details":"det2"}
                ]                                          
            </div>
  </form>
</body>
</html>

The behavior seems different across browsers but using Chrome (28.0.1500.72 at the moment):
When the page first loads, if i click on to the search box and type "ada", the grid filters correctly bu when i click the expand details triangle, nothing happens.
If i instead press tab on page load to get to the input, the details expand correctly after filtering.
Additionally, if i type the full "adam" it doesn't work when i tab, but does when I click. It seems like every other keystroke will break the details expanding.


Any help would be appreciated.
Dessie Lunsford
Top achievements
Rank 2
 answered on 26 Jul 2013
2 answers
180 views
Hi,

are there any examples of MVVM and dataviz working together? Is it even possible? I've been trying to get a working chart that gets updated based on changes in a underlying mvvm data model with no luck for about a week now. Any example would help!
Bart
Top achievements
Rank 1
 answered on 26 Jul 2013
1 answer
293 views
Hi All,

I have been trying to get the datasource to refresh or update itself with the contents of a PUT response it sends to an odata service.  I know normally the PUT would return 204 with updating  a record, but I am returning a 200 with the contents that where updated.  The main reason for this is that a timestamp (ETAG) value is updated and returned in the response.  So the next time an edit is done on it should work, but currently it does not.

I have checked fiddler request/responses they are correct, it just that data source is not being refreshed with the contents being sent in the response.

Do I have to do a force refresh on the datasource and retrieve that page of data or is there another way?

The timestamp field is nested in the json response so I don't know if that is the cause or not.

Here is an example of the  request

PUT https://localhost:444/admin/v2/accounts(6) HTTP/1.1
Host: localhost:444
Connection: keep-alive
Content-Length: 325
Cache-Control: max-age=0
Accept: application/json, text/javascript, */*; q=0.01
Origin: https://localhost:444
X-Requested-With: XMLHttpRequest
If-Match: "AAAAAAAADJ0="
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Content-Type: application/json
Referer: https://localhost:444/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6

{"Id":"6","Name":"Test Account  5","Registered":null,"WebsiteUrl":"Testing","IsEnabled":true,"AccountType":"Retailer","Tracking":{"CreatedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","CreatedOn":"2013-07-26T14:08:22.787","ModifiedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","ModifiedOn":"2013-07-26T16:54:20.57","Timestamp":"AAAAAAAADJ0="}}

Here is an example of the response.

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
ETag: "AAAAAAAADJ4="
Access-Control-Allow-Origin: *
DataServiceVersion: 3.0
Date: Fri, 26 Jul 2013 17:05:14 GMT
Content-Length: 425

{
  "odata.metadata":"https://localhost:446/admin/v2/%24metadata#accounts/@Element","Id":6,"Name":"Test Account  5","Registered":null,"WebsiteUrl":"Testing","IsEnabled":true,"AccountType":"Retailer","Tracking":{
    "CreatedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","CreatedOn":"2013-07-26T14:08:22.787","ModifiedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","ModifiedOn":"2013-07-26T17:05:13.9989111Z","Timestamp":"AAAAAAAADJ4="
  }
}

As you can see the ETag/Timestamp have been updated.

Any suggestions

Regards

Richard....
Richard
Top achievements
Rank 1
 answered on 26 Jul 2013
1 answer
117 views
Hello,

Here is a jsbin link to the problem I'm facing.

I want the autocomplete textbox to be docked left and right in a relative div and I ain't sure how to manage to width of the dropdown list items.

Also, while typing in the textbox, the dropdown seems to go up on the second letter typed.

Any input would be appreciated.

Thanx!
royguillaume
Top achievements
Rank 1
 answered on 26 Jul 2013
4 answers
152 views
Hi,

I am lazy loading some data into my chart and wondering how do I create a status message on the chart, similar to http://www.highcharts.com/stock/demo/lazy-loading?

Thanks,
Tonih
Tonih
Top achievements
Rank 1
 answered on 26 Jul 2013
2 answers
1.2K+ views
Hi,

I was wondering what is considered the "best" way to determine if a PanelBarItem is expanded or not? So far what I've been able to come up with is to check the "aria-expanded" property or see if the child <ul> is visible, both of which feel a bit dirty. Is there a better way, or is one of these two methods considered "better" than the other?

For context, I'm retrieving the item to check by using jquery.closest from one of the child items. Example:
function (id) {
  var child = $("#s-list-objectChild-" + id);
  var parent = child.closest("[id^='s-list-object-']");
  if (parent.isExpanded()) // Perform check here
    doSomething();
  else
    doSomethingElse();
}
Thanks,
Jeff
Jeff
Top achievements
Rank 1
 answered on 26 Jul 2013
2 answers
177 views
Hi All,

Can someone point me to the right data- attribute for virtual scrolling on a grid?

This is a the configuration option on the GRID

scrollable.virtual Boolean(default: false)

I have tried the following.

data-scrollable = "virtual"
data-scrollable-virtual="true"
data-scrollable = "virtual = true"

None of these work.  I would like virtual scrolling, but if not supported using data- attributes then can I modify the grid once it is  initialized?

I tested it by making sure the page count was less then the number of items in odata results set.  Fiddler shows the first request being send with the correct top value.

Thanks for any help.

Regards

Richard...
Richard
Top achievements
Rank 1
 answered on 26 Jul 2013
1 answer
889 views
I have been stuck with this problem without much luck. I've gone down multiple paths and done google search but can’t seem to find a solution that works. Any help would be greatly appreciated.
I am using Kendo MVC grid wired up for CRUD.

@model IEnumerable<CustomerModels>
@(Html.Kendo().Grid(Model)
.Name("grid")
.Columns(columns =>
    {
        columns.Bound(Customer => Customer.Name);
        columns.Bound(Customer => Customer.Number);
        columns.Bound(Customer => Customer.Phone);
        columns.Bound(Customer => Customer.DOB).Format("{0:d}").EditorTemplateName("Date");
        columns.Command(command => { command.Edit(); });
    })
                .DataSource(dataSource => dataSource
                            .Ajax()
                            .PageSize(20)         
                            .Read(read => read.Action("FilterMenuCustomization_Read", "Home"))
                                    .Model(model => { model.Id(c => c.Phone); model.Field(c=>c.DOB);})
                                           .Update(update => update.Action("FilterMenuCustomization_Update", "Home"))
                                   )
                                   
        .Pageable()
        .Sortable()
           )

When i try to edit the date field using Date Picker or even without any change to existing date, If i try to submit It gives me Error message as "DOB is not valid date".
Ex. 25/07/2013
I have included Culture and EditorTemplates as mentioned in some of the solutions i found on internet, But no help.
Any idea as to what i am doing wrong?
  
Petur Subev
Telerik team
 answered on 26 Jul 2013
1 answer
223 views
Does anyone know how to render a hierarchical grids within a View using the same model?  In my example,  the model i'm using "System.Data.DataTable" the main grid should display a list of 'projects' and the sub grid should display correlating 'designs' as a child grid.  I'm using DataTable because each customer could have different columns for their 'projects' and 'designs' in data.. Therefore, I cannot go with the fixed column solution, it MUST be dynamic columns.  When I'm using DataTable the parent grid and the child grid both are displaying the same columns because it's referencing the same model. Here's the code in my view:

    @(Html.Kendo()
        .Grid<System.Data.DataTable>()
        .Name("ProjectGrid")
        .ClientDetailTemplateId("template")
            .Columns(columns =>
            {
                foreach (System.Data.DataColumn column in Model.Columns)
                {
                    string strFormat = "", strTitle = column.Caption;
                    if (column.DataType == typeof(System.DateTime))
                        strFormat = "{0:" + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern + "}";


                    columns
                        .Bound(column.ColumnName)
                       .Groupable(column.ColumnName != "Id" && column.ColumnName != "AsyncErrorMessage")
                       .Title(strTitle)
                       .Hidden(column.ColumnName == "Id" || column.ColumnName == "AsyncErrorMessage")
                       .Format(strFormat)
                       .Width(200);
                }

            })
        .Pageable(paging=>paging.PageSizes(new int[]{10, 20 , 30, 50} ))
        .Sortable()
        .Navigatable()
        .Filterable()
        .Groupable()
        .Selectable(selectable => selectable
                .Type(GridSelectionType.Row))
        .ColumnMenu()

            .Resizable(resize => resize
                        .Columns(true))
        .DataSource(dataSource => 
            dataSource
                .Ajax()
                    .Model(model =>
                        {
                            foreach (System.Data.DataColumn column in Model.Columns)
                            {
                                model.Field(column.ColumnName, column.DataType);
                            }
                        })
                .Read(read => read.Action("GetProjects", "Designer"))
                .PageSize(20)  
        )        
        .HtmlAttributes(new { style = "height:100%" })
        .Scrollable()

    )


<script id="template" type="text/kendo-tmpl">
@(Html.Kendo()
    .Grid<System.Data.DataTable>()
    .Name("DesignerDesignGrid_#=Id#")
        .Columns(columns =>
        {
            foreach (System.Data.DataColumn column in Model.Columns)
            {
                string strFormat = "", strTitle = column.Caption;
                if (column.DataType == typeof(System.DateTime))
                    strFormat = "{0:" + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern + "}";


              columns
                        .Bound(column.ColumnName)
                       .Groupable(column.ColumnName != "Id" && column.ColumnName != "AsyncErrorMessage")
                       .Title(strTitle)
                       .Hidden(column.ColumnName == "Id" || column.ColumnName == "AsyncErrorMessage")
                       .Format(strFormat)
                       .Width(200);
            }
        })
        //.Events(events => events.Change("getSelectedRowId"))
    .DataSource(datasource => datasource
        .Ajax()      
        .Model(model =>
                        {
                            foreach (System.Data.DataColumn column in Model.Columns)
                            {
                                model.Field(column.ColumnName, column.DataType);
                            }
                        })  
        .PageSize(5)
        .Read(read => read
            .Action("GetDesigns", "Designer", new  { projectId = "#=Id#" })))
        .Pageable()
        .Sortable()
        .ToClientTemplate()
    )
    </script>

<script>
    var selected;
    function dataBound() {
        this.expand(this.tbody.find("tr.k-master-row").first());
    }
</script>
Vladimir Iliev
Telerik team
 answered on 26 Jul 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
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
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?