Telerik Forums
Kendo UI for jQuery Forum
1 answer
401 views

I am following the “Basic Usage” example.  I am using the variant wherein I specifically create a <span data-for=”id_of_validated_control”> for each field. In  this case, I have two fields, the first being "Name", the second being "Code".

“Name” and “Code” each have a ‘k-invalid-msg’ span.  Now let’s say I blank out the second field ‘Code’ first.  It’s get “Code is required” message.  So far so good.  Now I put a value in Code, then go to the field above it – “Name” – blank it out, and blur.  I expect the <span> next to "Name" to get a message, but what happens is that “Name is required” displays in the span adjacent to “Code” field, becauseat the moment I tab out of the "Name" field, the <span data-for=”name” class=”k-invalid-msg”/> is removed from the DOM, and Code’s <span> is the one populated.

I have tried several approaches.  The first approach is to declare my own <span data-for="name_of_validated_input" class="k-invalid-msg></span> after each <input> that has the "required" attribute.  I also tried not declaring my own <span>'s, and applying a validationMessage="xxx is required" to each <input> that has the "required" attribute.

Here is one of the <input> controls with an explicit <span>.  Note that this is copied from Chrome "inspect element" which is adding the ="" to required. 

<div class="form-FieldOuter" id="view-FieldBox1" style="display:block;">
<label for="view-FieldBox1CodeInput" class="form-label" style="overflow:hidden;">Code</label>
<input type="text" class="form-control" id="view-FieldBox1CodeInput" data-bind="value: Code" required="" validationmessage="Code is required.">
<span class="k-invalid-msg" data-for="view-FieldBox1CodeInput"></span>
</div>


And a couple of notes/comments:
1. In my program's html output, the attribute doesn't have a value, it looks like <input id="x" name="x" required validationmessage="blah blah"/> 
2. I've tried also assigning the name attribute.  But I see from other forum post that data-for relates to the 'id' attribute and not the 'name' attribute, so I think my use above should be correct in that regard.  (see: http://www.kendoui.com/forums/framework/validation/is-there-a-way-to-control-the-position-of-validation-messages.aspx , where it says To force it to use specific place for its hint, place a span with data-for="your_input_id" and class="k-invalid-msg", so that the Validator can recognize and use it )
3. I observe that data-role="validator" is being applied to the <div> that contains my form and all of the validated <input> and their <span> elements.
4. Using kendo.web.js from version 2012.1.322 Full-license not minified.

Mike
Top achievements
Rank 1
 answered on 25 Apr 2012
5 answers
116 views
Hi,

I'd like to get datas from a xml document that I have exported from mySQL database. 
So I want to create charts with these datas, I wrote down the script like this :

<body>


<div id="chart" style="width: 400px; height: 600px"></div>
        <script>


            ds = new kendo.data.dataSource({
                transport : {
                    read : {
                        url : "C:/Users/Julien/Downloads/kendo.xml"
                    }
                }
            })


            $("#chart").kendoChart({


                dataSource: ds,
                categoryAxis: {
                    categories: [January,February,March,April]
                },
                seriesDefaults: {
                    type: "line"
                }


            });
   </script>

    </body>
</html> 



Maybe it's totally wrong but I started to learn about Kendo UI and I didn't know so much about AJAX and stuff, so for now I have nothing appearing on my screen. 

The thing is that when I wrote some datas in local it works so if someone could help me I'd really apreciate it.

Thanks,

Julien

Julien
Top achievements
Rank 1
 answered on 25 Apr 2012
3 answers
435 views
I'm having trouble calling the update method exposed as a JSON endpoint by a .NET WCF domain service. I think the domain service is set up correctly because the read method is working fine - I can get data into the bound kendoGrid very nicely. But I can't seem to post any data to the domain service via the update method.

Fiddler shows the following when I try to update a record in the kendoGrid...
GET http://localhost:3223/DataServices/Application-myDomainService.svc/JSON/UpdateDATA?AUTOID=1&CODE1=code1&CODE2=code2 HTTP/1.1
Host: localhost:3223
Connection: keep-alive
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.83 Safari/535.11
Accept: application/json, text/javascript, */*; q=0.01
Referer: http://localhost:3223/Pages/Home.aspx
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: ASP.NET_SessionId=dl1a5qkkzbsaur0o5qlhuvhf

Does this mean that it's using a GET method to call the update endpoint rather than a POST? The response is a 404 error with message "Endpoint not found."

Any help here?
Michael
Top achievements
Rank 1
 answered on 24 Apr 2012
11 answers
470 views
I've just tried to convert my original ViewModel to a Kendo-based viewmodel, in hopes I'd be able to use this model to pick up functions from my custom template assigned to a Grid. This, however, doesn't seem to be the case.

Right now I have:

<script id="gridTemplate" type="text/x-kendo-template">
         <span class="k-icon k-arrow-next cursor detailLink" cId="#= ContactID #" data-bind="click: doSomething"></span>
</script>

With the template assigned to my Grid, and doSomething as a function within my Kendo ViewModel. The Grid only gets loaded when a user presses a button on the page, which may have something to do with it - but if it has, then it takes out the point of a View Model always being active.

Is this a known issue in the beta?
Luc
Top achievements
Rank 1
 answered on 24 Apr 2012
1 answer
223 views
Problem reproduced at http://jsfiddle.net/MenYM/12/

I am using a drop down list, with following bindings to a view model:
1. source (simple array of items)
2. value 

I have also defined the data-role and, perhaps most importantly for this query, a data-option-label.

The problem is that if the data source defined in the view model is defined as an empty array, and at some point the data source is modified, the drop down list has an empty element, even before the data-option-label. (See the jsfiddle linked above).

On the other hand, if the data source had an element and afterwards was modified in the same way, the drop down list does not have an empty element.

What could be the problem here? Any pointers are appreciated.

Thanks,
Siddhartha Agrawal
Georgi Krustev
Telerik team
 answered on 24 Apr 2012
6 answers
737 views
Does anyone have an example of a controller method that will get the success event to fire? I keep getting the unexpected result error. 

My current controller method looks like this. I have tried many different results and nothing seems to work.
        [Authorize]
        [HttpPost]
        public String AddFile(int Id, IEnumerable<HttpPostedFileBase> attachments)
        {
            
            Response.ContentType = "text/plain"; 
            return   @"{""status"": 0, ""data"": [{""DocumentId"": ""5""}]}"; 
 
        }


        $("#attachments").kendoUpload({
            async: {
                saveUrl: saveURL,
                removeUrl: removeURL,
                autoUpload: true
            },
            upload: attachOnUpload,
            success: attachOnSuccess,
            error: attachOnError
        });


function attachOnUpload(e) {
 
        e.data = { Id: '@Model.Id' }
 
    }
 
    function attachOnSuccess(e) {
         
        var hiddenField = $("#DocumentId");
        hiddenField.val(e.DocumentId);
        
 
    }
    function attachOnError(e) {
        debugger;
	//always fires no matter what is returned from controller

    }
James
Top achievements
Rank 1
 answered on 24 Apr 2012
2 answers
238 views
Hi,

I have a data-show function which loads up my listview tempate from a simple "data_testing_list" function which builds and returns a local array.

Now when I return to this view after first load, the listview has all nulls, so I "assume" (not sure) I cannot just re-create it using

$("#testing_listview").kendoMobileListView({ ...


for some reason (if so, could someone explain why this is so? as it seems a simple way to reload it?),

Could someone tell me the best practice for setting up this listview (I assume in .ready) and then reloading its data on subsequent shows?

function testing_show() {

$("#testing_listview").kendoMobileListView({

dataSource: kendo.data.DataSource.create({ data: data_testing_list(), group: "letter" }),

template: $("#testing_listview_template").html(),

headerTemplate: "${value}"

});

}

Thanks for your help
Matt

Matt
Top achievements
Rank 1
 answered on 24 Apr 2012
2 answers
397 views
How do I enable sorting on a grid when using a row template.

For example I took the "Row Template" demo and added "sortable: true", but this did not work.  Is there an additional step I am missing?

Here is what I tried:

<script>
                $(document).ready(function () {
                    $("#netflixTable").kendoGrid({
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            filter: [{
                                field: "Name",
                                operator: "contains",
                                value: "Star Wars"
                            }, {
                                field: "BoxArt.SmallUrl",
                                operator: "neq",
                                value: null
                            }],
                            transport: {
                                read: "http://odata.netflix.com/Catalog/Titles"
                            }
                        },
                        sortable: true,
                        rowTemplate: kendo.template($("#rowTemplate").html()),
                        height: 200
                    });
                });
            </script>


Less important: how can I add the alternating row backgrounde effect when using a row template?
Kjell
Top achievements
Rank 1
 answered on 24 Apr 2012
8 answers
464 views
For some weird reason the select event is not fired when i click on the results. Did the following :
 var autoComplete = $("#autoComplete").kendoAutoComplete({
  dataTextField: "name",
select : function(e) { console.log(e); }
...

});
but no joy. Also, i tried binding it afterwards like it suggests on the manual but nothing.
Finally i did the following : 

 autoComplete.popup.element.bind("click", function(e) {
   var index = $(e.currentTarget).index();
   var dataItem = autoComplete.dataSource.view()[index];
    
   console.log(dataItem);
});

but this is a hack job and i would much rather not use it
Brandon
Telerik team
 answered on 24 Apr 2012
1 answer
123 views
Hello,

I found out two bugs in kendo slider,
The first one is when you enable an slider which is enable the slider become crazy. When you go up and after go down two or three times, Slider does what it wants. You have to do sometimes a lot of clicks, sometimes a few clicks, but normally you have a click and it increase the value slider and that is not a good behavior.

The second one is when a slider is disable and you want to move the "circle" (drag and drop to change value slider) that raise too many errors.

<input id="slider" class="balSlider" />
            <script>
 
            $(document).ready(function(){
                $("#slider").kendoSlider({
                                increaseButtonTitle: "Right",
                                decreaseButtonTitle: "Left",
                                min: 0,
                                max: 10,
                                value: 1,
                                smallStep: 1,
                                largeStep: 1,
                                tickPlacement:"both"
                            }).data("kendoSlider");
 
                var slider = $("#slider").data("kendoSlider");
 
                slider.enable();
            });
 
 
            </script>
Hristo Germanov
Telerik team
 answered on 24 Apr 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?