Telerik Forums
Kendo UI for jQuery Forum
2 answers
558 views
Hi,

how can the we bind the json data for the chart.

Need to Call the JSON method in the controller
Alexander Valchev
Telerik team
 answered on 19 Dec 2012
3 answers
317 views
Is there a way to change the text of the Loading animation after it has been initialized ?

ShowBusy: function (txt) {
        if (txt != null)
            app.options.loading = "<H1>" + txt + "</H1>";
        app.showLoading();
    },

Best regards,
Petyo
Telerik team
 answered on 19 Dec 2012
3 answers
211 views
In July of this year Dimo added a nice example of dynamically resizing a grid.  A link to his post is here. This works very well unless you enable grouping on that same grid.

I took his jsfiddle and added a groupable: true --> http://jsfiddle.net/SDFsz/98/.

This works great when you resize but it doesn't work on the first run ( that is when resizeGrid gets called from DataBound event ).

Is there any event that fires after the Grouping box actually gets created and sized?
Dimo
Telerik team
 answered on 19 Dec 2012
2 answers
383 views
I have an array of objects that are read from a JSON file. I am having difficulty referencing attributes of the child object of the parent. What is the correct syntax or what step am I missing to accomplish what I am trying to do (which is conditional template formatting)? Any help would be appreciated. Thanks.

In this example, "control.type" is what I am after in the edit template.

My static JSON looks like this...

[
{"questiontext":"Please enter the first name.","control":{"@type":"textbox","@label":"First Name"},"answer":null,"comment":"This is where the comment goes"},
{"questiontext":"What is the status?","control":{"@type":"combobox","@label":"Status:","item":[{"@key":"Open","@value":"OP"},{"@key":"Canceled","@value":"CO"},{"@key":"Closed","@value":"CL"},{"@key":"Complete","@value":"CO"}]},"answer":null,"comment":null},
{"questiontext":"What is the status?","control":{"@type":"radiobutton","@label":"Status:","item":[{"@key":"Open","@value":"OP"},{"@key":"Canceled","@value":"CO"},{"@key":"Closed","@value":"CL"},{"@key":"Complete","@value":"CO"}]},"answer":null,"comment":null},
{"questiontext":"What was the date of the incident?","control":{"@type":"datetime","@mask":"datetime","@label":"Date:"},"answer":null,"comment":null}
]

<!DOCTYPE html>
<html>
<head>
    <title>Editing</title>
    <link href="../../iqaListTest/content/kendo/2012.3.1114/examples-offline.css" rel="stylesheet">
    <link href="../../../iqaListTest/content/kendo/2012.3.1114/kendo.common.min.css" rel="stylesheet">
    <link href="../../../iqaListTest/content/kendo/2012.3.1114/kendo.default.min.css" rel="stylesheet">
 
    <script src="../../../iqaListTest/scripts/kendo/2012.3.1114/jquery.min.js"></script>
    <script src="../../../iqaListTest/scripts/kendo/2012.3.1114/kendo.web.min.js"></script>
    <script src="../../iqaListTest/scripts/kendo/2012.3.1114/console.js"></script>
</head>
<body>
    <a class="offline-button" href="../index.html">Back</a>
    <div id="example" class="k-content">
    <div class="k-toolbar k-grid-toolbar">
        <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a>
    </div>
         
    <div class="listview-holder">
        <div id="listView"></div>
    </div>
 
    <!--<div id="pager" class="k-pager-wrap">
    </div>-->
 
    <script type="text/x-kendo-tmpl" id="template">
        <div class="iqa-view">
            <dl>
                <dt>Question</dt>
                <dd>${questiontext}</dd>
                <dt>Answer</dt>
                <dd>${answer}</dd>
                <dt>Comment</dt>
                <dd>${comment}</dd>
            </dl>
            <div class="edit-buttons">
                <a class="k-button k-button-icontext k-edit-button" href="\\#"><span class="k-icon k-edit"></span>Edit</a>
                <a class="k-button k-button-icontext k-delete-button" href="\\#"><span class="k-icon k-delete"></span>Delete</a>
            </div>
        </div>
    </script>
 
    <script type="text/x-kendo-tmpl" id="editTemplate">
        <div class="iqa-view">
            <dl>
                <dt>${control.label}</dt>
                <dd>
                    #if (control.type == 'textbox')  { #
                         <input type="text" data-bind="value:answer" name="answer" required="required" validationMessage="required" />
                         <span data-for="answer" class="k-invalid-msg"></span>
                    # } #              
                </dd>
            </dl>
            <div class="edit-buttons">
                <a class="k-button k-button-icontext k-update-button" href="\\#"><span class="k-icon k-update"></span>Save</a>
                <a class="k-button k-button-icontext k-cancel-button" href="\\#"><span class="k-icon k-cancel"></span>Cancel</a>
            </div>
        </div>
    </script>
 
    <script>
        $(document).ready(function () {
            var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "iqaData.txt",
                        dataType: "json"
                    }
                },
                change: function () {
                     
                }
            });
 
            var listView = $("#listView").kendoListView({
                dataSource: dataSource,
                template: kendo.template($("#template").html()),
                editTemplate: kendo.template($("#editTemplate").html())
            }).data("kendoListView");
 
            $(".k-add-button").click(function (e) {
                listView.add();
                e.preventDefault();
            });
        });
    </script>
    <style scoped>
        .iqa-view
        {
            float: left;
            width: 650px;
            margin: 5px;
            padding: 3px;
            -moz-box-shadow: inset 0 0 50px rgba(0,0,0,0.1);
            -webkit-box-shadow: inset 0 0 50px rgba(0,0,0,0.1);
            box-shadow: inset 0 0 50px rgba(0,0,0,0.1);
            border-top: 1px solid rgba(0,0,0,0.1);
            -webkit-border-radius: 8px;
            -moz-border-radius: 8px;
            border-radius: 8px;
        }
 
        .listview-holder
        {
            width: 700px;
            margin: 0 auto;
            padding: 0;
            border: 0;
            border: 1px solid rgba(0,0,0,0.1);
            height: 400px;
            overflow: auto;
        }
 
        .iqa-view dl
        {
            margin: 10px 0;
            padding: 0;
            min-width: 0;
        }
        .iqa-view dt, dd
        {
            float: left;
            margin: 0;
            padding: 0;
            height: 30px;
            line-height: 30px;
        }
        .iqa-view dt
        {
            clear: left;
            padding: 0 5px 0 15px;
            text-align: right;
            opacity: 0.6;
            width: 100px;
        }
        .k-listview
        {
            border: 0;
            padding: 0;
            min-width: 0;
        }
        .k-listview:after, .iqa-view dl:after
        {
            content: ".";
            display: block;
            height: 0;
            clear: both;
            visibility: hidden;
        }
        .edit-buttons
        {
            text-align: right;
            padding: 5px;
            min-width: 100px;
            border-top: 1px solid rgba(0,0,0,0.1);
            -webkit-border-radius: 8px;
            -moz-border-radius: 8px;
            border-radius: 8px;
        }
 
        .k-toolbar, #listView
        {
            width: 660px;
            margin: 0 auto;
            -webkit-border-radius: 11px;
            -moz-border-radius: 11px;
            border-radius: 11px;
        }
         
        span.k-invalid-msg
        {
            position: absolute;
            margin-left: 160px;
            margin-top: -26px;
        }
    </style>
</div>
</body>
</html>
Nikolay Rusev
Telerik team
 answered on 19 Dec 2012
1 answer
128 views
I'm a little confused on how I can determine which objects are selected in the ListView... 

Thanks in advance for the help.
Iliana Dyankova
Telerik team
 answered on 19 Dec 2012
3 answers
2.8K+ views

I am trying to implement a GRID having columns with different images.

Folloing is the logic for showing 'IsLocked' and 'IsLocked' as a boolean (TRUE/FALSE) on the GRID. Those boolean values we pass through
the LIST 'SeriesValues'.

I have been asked to show different images for BOOLEAN values.
for excample
if 'IsLocked' ==TRUE then
    show image1.ico
else
    show image2.ico

  <div data-bind="kendoGrid: { data:  SeriesValues, columns: [{field: 'IsLocked', title: 'Is Locked', width: 150}, {field: 'IsValid', title: 'Is Valid', width: 150},
   {field: 'PeriodEnd', title: 'Period End', template: '#= moment(new Date(PeriodEnd)).format(\'YYYY-MM-DD HH:mm\') #', width: 250},
   {field: 'Quantity', title: 'Quantity', width: 150},
   {field: 'QualityIndex',title: 'Quality Index'}], scrollable: true, sortable: true}" style="height: 200px"></div>
 </div>
Jayesh Goyani
Top achievements
Rank 2
 answered on 19 Dec 2012
1 answer
85 views
Dear Kendo Team,

I am using a kendo combobox which displays util codes which belongs to each customer water meter. When user selects one
util code the kendo grid will populate the meter reading belongs to that meter. Now suppose that the user selects one customer 
util code from kendo combobox it is calling a handler HandlerGetUtilsDetails.ashx. 

My first question is the handler get called twice when I choose a util code. This was recognize as a bug in kendo combobox Our developers are still facing this issue.Is there anyway that we can prevent multiple calls to the handler?

The second issue is think that you get some results for a given util code. You should be able to navigate through the grid
using the paging available. Suppose you want to check another util code then the user will again choose the relavent util
code. Now the problem is the user navigates to the end of the result using the page numbers and select go to first page
button in the kendo grid navigation bar. Now instead of showing the first page of the current records it shows previous
result  first page( result belongs to the previous util code details which the user browse little bit earlier).

I am sending my code to you guys to review. A quick solution is highly appreciated because we cannot go down with development.
Cheers!!!

My code block looks like this

<script type="text/javascript">
    
$(document).ready(function () {
   $("#DropDownList1").width(500).kendoComboBox();

var destroyer1;
var destroyer2;

$("#DropDownList1").kendoComboBox({
placeholder: "Select Meter...",
dataTextField: "Display",
dataValueField: "CustCode",

suggest: true,
dataSource: {
serverFiltering: true,
serverPaging: true,
transport: {
read: function (options) {
var persons;
var new_obj;
var done;
destroyer1 = $.ajax({
url: "HandlerGetUtils.ashx",
dataType: "text",
success: function (result) {
// notify the DataSource that the operation is complete
persons = '';
persons = result.split(",");
new_obj = { data: [] };
for (var a = 0; a < persons.length - 1; a++) {
var temp = persons[a].split(":");
for (var b = 0; b < 1; b++) {
    
if (temp[2] == "" && temp[1] != "undefined") {
new_obj.data.push({
CustCode: temp[0] + "," + temp[1],
UtilCode: temp[1],
Display: temp[1] + "-" + temp[3]
});
done = new_obj.data;
result = done;
options.success(result);
}
if (temp[2] != "" && temp[1] != "undefined") {
new_obj.data.push({
CustCode: temp[0] + "," + temp[1],
UtilCode: temp[1],
Display: temp[1] + "-" + temp[2]
});
done = new_obj.data;
result = done;
options.success(result);
}
}
    
}
    
}
});
}
}
}
});
    
var combobox = $("#DropDownList1").data("kendoComboBox");
    
combobox.bind("change", function (e) {
// handle event
 
// bind to the change event
var value1 = combobox.value();
var valueselector = value1.split(",");
var text1 = combobox.text();
var hell = null;

destroyer2 = $.ajax({
url: "HandlerGetUtilsDetails.ashx",
data: { utilcodes: EncodeURIC(valueselector[1]), customercodes: EncodeURIC(valueselector[0]) },
dataType: "json",
   cache:false,
success: function (result) {
   // notify the DataSource that the operation is complete
   if (valueselector[1] != "undefined" && valueselector[1] != null && valueselector[1] != "" ) {
       
       if (result != "" && result != "undefined" && result != null && result != "[]") {
           hell = null;
           hell = result;
           $("#gridMeterReading").kendoGrid({
               dataSource: {
                   data: hell,
                   pageSize: 12,
                   schema: {



                       model: {

                           fields: {
                               ReadDate: { field: "ReadDate", type: "date", format: "{0:dd/MM/yyyy}" },

                           }
                       }
                   }
               },

               pageable:true,
               groupable: true,
               sortable: true,
               scrollable: false,
               filterable: true,
               columns: [
                                    { field: "Meter", title: "Meter" },
                                    { field: "ReadDate", title: "ReadDate", type: "date", format: "{0:dd/MM/yyyy}" },
                                    { field: "Reading", title: "Reading" },
                                    { field: "UtilCode", title: "UtilCode" },
                                    { field: "Actual", title: "Actual" }

               ]








           });
                            
       

           var dataSource = $("#gridMeterReading").data("kendoGrid").dataSource;
           var filters = dataSource.filter();
           var allData = dataSource.data();
           dataSource.cache(false);
           var historyCount = history.length;
           history.go(-historyCount);

       }
       else{

                            
           var data = "";
           var dataSource = new kendo.data.DataSource({
               data: data,
               pageSize: 12
           });
           $("#gridMeterReading").kendoGrid({
               dataSource: dataSource,
               pageable: true,
               groupable: true,
               sortable: true,
               scrollable: false,
               filterable: true,

               columns: [
                                    { field: "Meter", title: "Meter" },
                                    { field: "ReadDate", title: "ReadDate" },
                                    { field: "Reading", title: "Reading" },
                                    { field: "UtilCode", title: "UtilCode" },
                                    { field: "Actual", title: "Actual" }

               ]

           });
       }

      
   }
}
});

});
    
});
</script>
Daniel
Telerik team
 answered on 19 Dec 2012
1 answer
338 views
  
hai i was trying with batch editing , i could retrieve only max 15,000 rows if the count exceeds more than 15,000
nothing is coming  ?? .. please help 


// model 

public partial class ItemMaster
    {
        public string Item_Code { get; set; }
        public string Item_Name { get; set; }
    }


// controller

  public class itemController : Controller
    {
        Entities db = new Entities();

        public ActionResult index()
        {
            return View();
        }

        public ActionResult Editing_Read([DataSourceRequest] DataSourceRequest request)
        {
            return Json(SessionProductRepository.All().ToDataSourceResult(request));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_Create([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<ItemMaster > products)
        {
            var results = new List<ItemMaster >();

            if (products != null && ModelState.IsValid)
            {
                foreach (var product in products)
                {
                    SessionProductRepository.Insert(product);
                    results.Add(product);
                }
            }

            return Json(results.ToDataSourceResult(request, ModelState));
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<ItemMaster > products)
        {
            if (products != null && ModelState.IsValid)
            {
                foreach (var product in products)
                {
                    var target = SessionProductRepository.One(p => p.Item_Code  == product.Item_Code );
                    if (target != null)
                    {
                        target.Item_Name   = product.Item_Name;
                       
                        SessionProductRepository.Update(target);
                    }
                }
            }            

            return Json(ModelState.ToDataSourceResult());
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Editing_Destroy([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<ItemMaster > products)
        {            
            if (products.Any())
            {
                foreach (var product in products)
                {
                    SessionProductRepository.Delete(product);
                }
            }

            return Json(ModelState.ToDataSourceResult());
        }
    }


//SessionProductRepository
 
public class SessionProductRepository
    {  
        public static IList<ItemMaster > All()
        {
            IList<ItemMaster> result = (IList<ItemMaster>)HttpContext.Current.Session["item"];
            if (result == null)
            {
                Entities DB = new Entities();
                HttpContext.Current.Session["item"] = result = DB.ItemMasters;
                    
                 
            }
            return result;
        }
        
        public static ItemMaster One(Func<ItemMaster, bool> predicate)
        {
            return All().Where(predicate).FirstOrDefault();
        }
        
        public static void Insert(ItemMaster product)
        {
            product.Item_Code = All().OrderByDescending(p => p.Item_Code ).First().Item_Code  + 1;
            All().Insert(0, product);
        }
        
        public static void Update(ItemMaster product)
        {
            ItemMaster target = One(p => p.Item_Code  == product.Item_Code );
            if (target != null)
            {
                target.Item_Code = product.Item_Code;
                target.Item_Name  = product.Item_Name; 
            }
        }
        
        public static void Delete(ItemMaster product)
        {
            ItemMaster target = One(p => p.Item_Code  == product.Item_Code);
            if (target != null)
            {
                All().Remove(target);
            }
        }
    }
     
// my view 


@(Html.Kendo().Grid<MvcApplication1.Models.ItemMaster>()    
    .Name("Grid")    
    .Columns(columns => {        
        columns.Bound(p => p.Item_Code );
        columns.Bound(p => p.Item_Name ).Width(140); 
        columns.Command(command => command.Destroy()).Width(110);
    })
    .ToolBar(toolbar => {
        toolbar.Create();
        toolbar.Save();        
    })
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
    .Sortable()
    .Scrollable()
    .DataSource(dataSource => dataSource
             
        .Ajax()         
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(p => p.Item_Code ))
        .Create("Editing_Create", "item")
            .Read("Editing_Read", "item")
            .Update("Editing_Update", "item")
            .Destroy("Editing_Destroy", "item")
    )
)
<script type="text/javascript">
    function error_handler(e) {
        if (e.errors) {
            var message = "Errors:\n";
            $.each(e.errors, function (key, value) {
                if ('errors' in value) {
                    $.each(value.errors, function () {
                        message += this + "\n";
                    });
                }
            });
            alert(message);
        }
    }
</script> 





Posted 11 hours ago (permalink)

hai i was trying with batch editing , i could retrieve only max 15,000 row if count exceeds more than 15,000
nothing is coming  ?? 

Posted 11 hours ago (permalink)

hai i was trying with batch editing , i could retrieve only max 15,000 row if count exceeds more than 15,000
nothing is coming  ?? 

Posted 11 hours ago (permalink)

hai i was trying with batch editing , i could retrieve only max 15,000 row if count exceeds more than 15,000
nothing is coming  ?? 

Posted 11 hours ago (permalink)

hai i was trying with batch editing , i could retrieve only max 15,000 row if count exceeds more than 15,000
nothing is coming  ?? 
Daniel
Telerik team
 answered on 18 Dec 2012
2 answers
3.1K+ views
Hi there,
I've got a datatype with a RoundID identity column which is generated in the database. This means that it shouldn't be edited, and it will be automatically populated when a new record is added. I would like to display it as read only.
I see from various places that there used to be a .Bound().ReadOnly() method, but this seems to be missing from the latest version. Am I missing something?
If not, can somebody point me in the direction of how to create a custom template or some such to make this work?

Thanks
Dave
Top achievements
Rank 1
 answered on 18 Dec 2012
1 answer
565 views
Hi, Sorry for the dumb question, but I am VERY new to MVC.  i am trying to lean how to use the Kendo UI Grid to display data from a model.  I am trying to  following the "local data" example but i get the compile error message:
Compiler Error Message: CS1502: The best overloaded method match for 'Kendo.Mvc.UI.Fluent.WidgetFactory.Grid(System.Data.DataTable)' has some invalid arguments

The code is below.  It's pretty basic, doesn't do anything.  I just want to get something to display. I have seen similar questions posted, but I am so new to this stuff that the answers just aren't making sense yet.  Thanks in advance for helping the newbie!

my cshtml looks like this:
@model FactFinder.ClientList.Models.Clients
            
@{
    ViewBag.Title = "Fact Finder";
}
 
<h2>@ViewBag.Message</h2>
 
        Add a new client or select an existing client from the list below. <br />
     
    @Html.Kendo().Grid(Model);    
              
    <input id="NewClient" type="button" value="New Client" />  <input id="EditClient" type="button" value="Edit Client" /> <input id="DeleteClient" type="button" value="Delete Client" /><br />
    @Html.ActionLink("Get Personal Data", "Index", "DataInput")<br />

Model looks like this:
namespace FactFinder.ClientList.Models
{
    public class Clients
    {
        [ScaffoldColumn(false)]
        public int ClientNumber
        {
            get;
            set;
        }
 
        [Required]
        [DisplayName("Client Name")]
        public string ClientName { get; set; }
 
        [DisplayName("Spouse Name")]
        public string SpouseName { get; set; }
 
         
    }
}
Marty
Top achievements
Rank 1
 answered on 18 Dec 2012
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
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)
SPA
Filter
Drawing API
Drawer (Mobile)
Globalization
Gauges
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
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Collapsible
Localization
MultiViewCalendar
Touch
Breadcrumb
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
Popover
DockManager
FloatingActionButton
TaskBoard
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
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?