Telerik Forums
Kendo UI for jQuery Forum
1 answer
70 views
Hi, I'm try to use Kendo grid follow demos This --> http://demos.kendoui.com/web/grid/editing-popup.html

But Gird cann't Bind data 

Follow Controllers, and cshtml


public ActionResult Section()
       
{
           return View();
       }
 
       public ActionResult EditingPopup_Read([DataSourceRequest] DataSourceRequest request)
       {
           return Json(db.Sections.Where( s=>s.IsPublished == true).ToList().ToDataSourceResult(request));
       }
 
       [AcceptVerbs(HttpVerbs.Post)]
       public ActionResult EditingPopup_Create([DataSourceRequest] DataSourceRequest request, Section section)
       {
           if (section != null && ModelState.IsValid)
           {
               db.Sections.Add(section);
               db.SaveChanges();
           }
 
           return Json(new[] { section }.ToDataSourceResult(request, ModelState));
       }
 
       [AcceptVerbs(HttpVerbs.Post)]
       public ActionResult EditingPopup_Update([DataSourceRequest] DataSourceRequest request, Section section)
       {
           if (section != null && ModelState.IsValid)
           {
               var target = db.Sections.FirstOrDefault( s => s.SectionID == section.SectionID);
               if (target != null)
               {
                   target.Name = section.Name;
                   target.Description = section.Description;
 
                   db.Entry<Section>(section).State = System.Data.EntityState.Modified;
                   db.SaveChanges();
               }
           }
 
           return Json(ModelState.ToDataSourceResult());
       }
 
       [AcceptVerbs(HttpVerbs.Post)]
       public ActionResult EditingPopup_Destroy([DataSourceRequest] DataSourceRequest request, Section section)
       {
           if (section != null && ModelState.IsValid)
           {
               var target = db.Sections.FirstOrDefault(s => s.SectionID == section.SectionID);
               if (target != null)
               {
                   target.IsPublished = false;                 
 
                   db.Entry<Section>(section).State = System.Data.EntityState.Modified;
                   db.SaveChanges();
               }
           }
           return Json(ModelState.ToDataSourceResult());
       }
@(Html.Kendo().Grid<MVC4Kendo.Models.Section>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.Bound(p => p.Name);
        columns.Bound(p => p.Description).Width(100);
        columns.Bound(p => p.IsPublished).Width(100);      
        columns.Command(command => { command.Edit(); command.Destroy(); }).Width(160);
    })
    .ToolBar(toolbar => toolbar.Create())
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .Pageable()
    .Sortable()
    .Scrollable()
    .HtmlAttributes(new { style = "height:430px;" })
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(20)
        .Events(events => events.Error("error_handler"))
        .Model(model => model.Id(p => p.SectionID))
        .Create(update => update.Action("EditingPopup_Create", "Grid"))
        .Read(read => read.Action("EditingPopup_Read", "Grid"))
        .Update(update => update.Action("EditingPopup_Update", "Grid"))
        .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))
    )
)
<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>


Vladimir Iliev
Telerik team
 answered on 26 Jun 2013
3 answers
190 views
Assuming your data only has two levels of depth, in which case would you favor an array of (objects containing a) DataSource versus a HierarchicalDataSource and vice versa?

In such a case, we are tempted to use option 1 because the DataSource is much better documented and easy to grasp than the HierarchicalDataSource but the HierachicalDataSource might have hidden benefits worth the learning curve.
Alexander Valchev
Telerik team
 answered on 26 Jun 2013
3 answers
4.6K+ views
I have a combo box set up to cascade to another combo box. This works.  I have mapped both a change event and a select event in the "parent" - - both of which also work. I am planning to observer the state of the "parent"  knockout via the knockout-kendo plugin.  I expect this to work.

BUT - I need to be able to trigger the cascade programmatically, as well.  That is, I need to programmatically change the selected index of the "parent".  To test this in advance of mapping it in knockout,  I have a test button that successfully changes the selected item in the "parent".  So, this works.

Here is problem: neither the change event nor a select event are triggered in response to the following (which is in the test button click handler):
var cbx = $("select").data("kendoComboBox")
cbx.select(2);
That is, the combo box changes state but kendo is not triggering either of  the events.

I have tried this in various fiddles (modifying a similar situation) and it does not work there either.

This is quite important to us, so please let me know if this is not supported.

Thanks

S



Alexander Valchev
Telerik team
 answered on 26 Jun 2013
1 answer
105 views
I'm trying to figure out how to change the height of a basic sparkline. I've tried the following:

01.$("#hum-log").kendoSparkline({
02.                type: "area",
03.                data: [
04.                    71, 70, 69, 68, 65, 60, 55, 55, 50, 52,
05.                    73, 72, 72, 71, 68, 63, 57, 58, 53, 55,
06.                    63, 59, 61, 64, 58, 53, 48, 48, 45, 45,
07.                    63, 64, 63, 67, 58, 56, 53, 59, 51, 54
08.                ],
09.                height: 50,
10.                tooltip: {
11.                    format: "{0} %"
12.                }
13.            });
But it did not seem to make a difference.
Iliana Dyankova
Telerik team
 answered on 26 Jun 2013
3 answers
591 views
Hello,i am a computer science student ,working for a small software company and totally newbie about KendoUI.
I have a MVC project  that connects to database ,get and shows data's on KendoUI grid.I would like to  use combobox on my custom editor template with KendoUI grid pop up.

There is Kendo combobox on Index page.It fetchs and shows records from db  with selected column().
I am using  Kendo grid -  pop up  as a  interface.There are add,edit, and update buttons.When i click add or edit button  pop up screen opens which is related to my custom template.Every command is working well(add,edit,delete)

The problem is when i add Kendo combobox to my custom editor template , it  shows nothing on grid.Edit and delete buttons are missing and when i click to add button it shows this ajax code.It looks like some problem about rendering.
{"Data":[],"Total":4,"AggregateResults":null,"Errors":null}

Here is my Kendo combobox code:
@(Html.Kendo().ComboBox()
  .Name("productComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
  .DataTextField("ALLERGYTYPE") //Specifies which property of the Product to be used by the combobox as a text.
  .DataValueField("ID") //Specifies which property of the Product to be used by the combobox as a value.
// .Filter(FilterType.Contains)
 .Placeholder("ALLERGYTYPE")
  
 .DataSource(source =>
 {
    source.Read(read =>
    {
        read.Action("GetProducts", "AllergiesData"); //Set the Action and Controller name
    })
    .ServerFiltering(true); //If true the DataSource will not filter the data on the client.
 })

Getting data controller for combobox -
public JsonResult GetProducts()
{
    PHRDevEntities patient = new PHRDevEntities();
 
 
    return Json(patient.PR_PATIENTALLERGY, JsonRequestBehavior.AllowGet);
 
 
}

Another controller to get,create ,update etc.
public ActionResult Get([DataSourceRequest]DataSourceRequest request)
       {
           return Json(DataAccess.Get(request), JsonRequestBehavior.AllowGet);
       }
 
 
       public ActionResult CreateSingle([DataSourceRequest]DataSourceRequest request, TEntity itemNew)
       {
           return Json(DataAccess.Create(request, itemNew.ToArrayFromObject(), false, ModelState), JsonRequestBehavior.AllowGet);
       }
 
public ActionResult Create([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<TEntity> itemsNew)
       {
           return Json(DataAccess.Create(request, itemsNew, true, ModelState));
       }
 
       public ActionResult UpdateSingle([DataSourceRequest]DataSourceRequest request, TEntity itemUpdated)
       {
           return Json(DataAccess.Update(request, itemUpdated.ToArrayFromObject(), false, ModelState), JsonRequestBehavior.AllowGet);
       }
 
 
       public ActionResult DestroySingle([DataSourceRequest]DataSourceRequest request, TEntity itemToDelete)
       {
           return Json(DataAccess.Destroy(request, itemToDelete.ToArrayFromObject(), false, ModelState), JsonRequestBehavior.AllowGet);
       }

My custom editor template:
@model KendoUIMvcApplication1.DATA.PR_PATIENTALLERGY
       <strong>PR_PATIENTALLERGY</strong> <br />
 
        <table width="100%" cellspacing="5" style="margin:20px">
                                <tr>
                                    <td width="10%">@Html.LabelFor(model => model.PATIENTID)</td>
                                    <td width="40%">@Html.EditorFor(model => model.PATIENTID)
                                                    @Html.ValidationMessageFor(model => model.PATIENTID)</td>
 
                                    <td width="10%">@Html.LabelFor(model => model.DOCTOR)</td>
                                    <td width="40%" >@(Html.Kendo().ComboBox()
    .Name("productComboBox") //The name of the combobox is mandatory. It specifies the "id" attribute of the widget.
    .DataTextField("ALLERGYTYPE") //Specifies which property of the Product to be used by the combobox as a text.
    .DataValueField("ID") //Specifies which property of the Product to be used by the combobox as a value.
   // .Filter(FilterType.Contains)
    .Placeholder("ALLERGYTYPE")
     
    .DataSource(source =>
    {
       source.Read(read =>
       {
           read.Action("GetProducts", "AllergiesData"); //Set the Action and Controller name
       })
       .ServerFiltering(true); //If true the DataSource will not filter the data on the client.
    })
    //.SelectedIndex(0) //Select first item.
     
)
                             @Html.ValidationMessageFor(model => model.DOCTOR)</td>
 
                                </tr>
                     <tr>
                                 <td width="10%">@Html.LabelFor(model => model.ISACTIVE)</td>
                                    <td width="40%" >@Html.EditorFor(model => model.ISACTIVE)
                                                                @Html.ValidationMessageFor(model => model.ISACTIVE)</td>
                  </tr>
                            </table>
I have also DataAccess methods to control data.I can post them if it is needed.
He is the almost same problem with me:  stackoverflow
Vladimir Iliev
Telerik team
 answered on 26 Jun 2013
1 answer
77 views
Hi there I have a line chart with grouped data and narrowRange: true set.

When one of my datapoints has a null value it seems that narrow range is ignored.  Folks are choosing series from a dropdown and when one series has a null the scale changes suddenly which isn't ideal.

Here is a fiddle with all datapoints for each line  and narrowRange working well-  http://jsfiddle.net/jriley17/vDdmt/
and here is one with a null value for one of the points -  http://jsfiddle.net/jriley17/j83Sk/

thanks!
Iliana Dyankova
Telerik team
 answered on 26 Jun 2013
1 answer
105 views
I have following code and I am getting e.dataItem as undefined. Is there a way to get access to dataItem and its properties at client using JavaScript?

Html.Kendo().Grid<AdminReport>()   
.Name("AdminReportList")
.Columns(c =>        
{
c.Bound(r => r.Name).Title("Report Name").Width(50);                    
c.Bound(r => r.Id).Title(action).Width(230).Sortable(false).Filterable(false)
})
.Pageable(p => p.PreviousNext(true))
.Sortable()
.Filterable()   
.Events(e => e.DataBound("onRowBound"))   
.DataSource(d => d       
.Ajax()       
.Model(m => m.Id(r => r.Id))       
.Read(read => read.Action("_ListAllReports", "AdminReports"))       
.Events(e => e.Error("OnError")))
.Render();
function onRowBound(e) {
    
  if ((e.dataItem.SomeProperty === true)) {
       //Some code...
    }
 
}
Dimiter Madjarov
Telerik team
 answered on 26 Jun 2013
1 answer
96 views
Is there way to show spinner for chart while used datasource fetches data from server (ajax call)?

Thanks!

Kiril Nikolov
Telerik team
 answered on 26 Jun 2013
2 answers
120 views
I want the Stacked bars have no border, how can I config?
wei
Top achievements
Rank 1
 answered on 26 Jun 2013
7 answers
324 views
Reading http://docs.kendoui.com/getting-started/framework/spa/view I understand that the "render" method renders a view inside a container by replacing the current content with the new content.

However, when testing, I did not see that behaviour. Actually on "render" the view is appended to the current content, inside the wrapping "div" element.

Michael G. Schneider
mgs
Top achievements
Rank 1
 answered on 26 Jun 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)
SPA
Filter
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
OrgChart
TextBox
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
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
StockChart
ContextMenu
TimePicker
DateTimePicker
RadialGauge
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?