Telerik Forums
Kendo UI for jQuery Forum
1 answer
165 views
hello
I'm new to kendo and was testing to see if buy the product while I'm making examples to see if I can use

I have a problem. I'm trying to do the  ForeignKeyColumn example but canĀ“t  get the combobox when running
it show me a textbox (where should be the combo for my foreingkey) and 
I can edit it and change the id and grabs fine the data.    but I need a combo and i know something  is
 missing but can figure what

can you help please? 

My View

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.CiudadViewModel>()
    .Name("Grid")    
    .Columns(columns => {        
        columns.Bound(p => p.id);
        columns.ForeignKey(p => p.empresa, (System.Collections.IEnumerable)ViewData["employees"], "id", "descripcion");        
        columns.Bound(p => p.descripcion);      
    })    
    .ToolBar(toolBar => toolBar.Save())
    .Editable(editable => editable.Mode(GridEditMode.InCell))
    .Pageable()
    .Sortable()
    .Scrollable()
    .Filterable()
    .DataSource(dataSource => dataSource        
        .Ajax()         
        .Batch(true)
        .ServerOperation(false)
        .Events(events => events.Error("errorHandler"))
        .Model(model => { 
            model.Id(p => p.id);
            model.Field(p => p.id).Editable(false);                
        })
        .Read(read => read.Action("ForeignKeyColumn_Read", "Home"))
            .Update(update => update.Action("ForeignKeyColumn_Update", "Home"))       
    )
)

MY VIEW MODEL

public class CiudadViewModel
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
        public int id { get; set; }

        public string descripcion { get; set; }

        public int empresa { get; set; }

        [UIHint("Empresas"), Required]
        public EmpresaViewModel Empresa { get; set; }
    }

MY CONTROLLER 

 public ActionResult GridForeingKey()
        {
            PopulateEmployees();
            return View();
        }

        private void PopulateEmployees()
        {
            ViewData["employees"] = new EFDbContext().Empresas
                        .Select(e => new EmpresaViewModel()
                        {
                            id = e.id,
                            descripcion = e.descripcion
                        })
                        .OrderBy(e => e.descripcion);              
        }

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

    public class SessionClientOrderRepository
    {
        public static IEnumerable<CiudadViewModel> All()
        {
            IEnumerable<CiudadViewModel> result = HttpContext.Current.Session["ciudad"] as IEnumerable<CiudadViewModel>;
            if (result == null)
            {
               HttpContext.Current.Session["ciudad"] = result = new EFDbContext().Ciudades
                    .Select(o => new CiudadViewModel
                    {
                        id = o.id,
                        descripcion = o.descripcion,
                        
                        empresa = o.Empresa ,
                        Empresa = new EmpresaViewModel
                        {
                            descripcion = o.descripcion,
                            id = o.id
                        }
                    }).ToList();
            }
            return result;
        }
    } 
Emo
Top achievements
Rank 1
 answered on 14 Aug 2012
1 answer
138 views
Hi,

Is it possible to add a different click event on each one of the bar chart categories?

So if I have 

categoryAxis: 
{
	categories: ["Bulgaria", "France", "Germany", "Italy", "Spain", "UK", "US"]
}

Is there any way I could have it so that when someone clicks on "Bulgaria", they are taken to "page.html#Bulgaria" for example?

thank you
Alex
Top achievements
Rank 1
 answered on 14 Aug 2012
3 answers
293 views
I specify a url for the window 'content' property. If a server error occurs on window open then my error handler is invoked as expected.

But how do I access the result of the url request? It's of no use to have a custom error page if I cannot display the message. I havent' been able to find any proper documentation on the error handlers 'e' parameter and I haven't found anything interesting using the debugger.
Alex Gyoshev
Telerik team
 answered on 14 Aug 2012
5 answers
1.1K+ views
Is this the actual implementation of kendo grid?
I wanted to have something like:
@(Html.Kendo().Grid(Model)
      .Name("Foo")
      .Events(e => e.DataBound("server_databound"))
)
and my script:
<script>
function server_databound(){
      alert("hey there!");
}
</script>

when the grid is loaded, the alert isn't fired until I included these:
.DataSource(ds => ds
     .Ajax()
)

is kendo grid's databound event only fired with ajax binding?
what may be a cleaner workaround for this that you might suggest?
Nikolay Rusev
Telerik team
 answered on 14 Aug 2012
1 answer
111 views

1) bar charts showing values like 4000 etc i want to present this value like "4.0 k". is there any way to format like this?
2) line chart labels values and bar chart values are over ride when those are in same position so is there any to show the values on top when the values are over ridden only ,other wise it should be in bottom
3) My X axis values are started from 2 nd line and  i want to start from 1 line

Barbaros Saglamtimur
Top achievements
Rank 1
 answered on 14 Aug 2012
0 answers
61 views
1 answer
110 views
In my grid the dirty flags aren't being removed after a successful update to the server. Does the server need to respond with a specific type of message to enable this to happen? It's currently returning an HTTP 200.
Nikolay Rusev
Telerik team
 answered on 14 Aug 2012
4 answers
297 views
I'm trying to sync changes to my remote datasource but it's only changing them locally. 

Here's my code:

Datasource:

var dataSource = new kendo.data.DataSource({
            transport: {
                read: {
                    url: "http://localhost:8080/databases/shipping/docs",
                    dataType: "json",
                    data: {
                        q: "javascript"
                    }
                },
                update: {
                    url: "http://localhost:8080/databases/shipping/docs",
                    dataType: "json"
                }
            },
            schema: {
                model: {
                    id: "id",
                    fields: {
                        Name: { type: "string" },
                        Telephone: { type: "string" },
                        Address: { type: "string" },
                        Suburb: { type: "string" },
                        City: { type: "string" },
                        Province: { type: "string" },
                        Country: { type: "string" },
                        PostalCode: { type: "string" },
                        DeliveryStatus: { type: "string" },
                        Packages: { type: "auto" }
                    }
                }
            }
        });

"Save Changes" Button Click: It might be a bit messy because I've been trying loads of different techniques

var packageId;
 
        function saveChanges(e) {
            var button = e.button,
                item = packageDataSource.get(button.data("itemId"));
            packageId = item.ID;
             
            dataSource.fetch(function () {
                var packageToUpdate = dataSource.data()[id].Packages[packageId];
                packageToUpdate.Status = "Delivered";
                dataSource.sync();
                console.log(dataSource);
            });
        }

I can see the changes reflecting in my console when I check the console.log(dataSource); after the dataSource.sync(); but when I check my remote database there's no change. 
Devon
Top achievements
Rank 1
 answered on 14 Aug 2012
9 answers
486 views
Hi, somebody would have some example a Grid with 2 o 3 DropDownList in cascading???

Thanks you.
srinivas
Top achievements
Rank 1
 answered on 14 Aug 2012
0 answers
30 views
Hi Team,
I am getting some white space after records while scrolling is enabled . Please find attachment and solve my problem.
Prasad
Top achievements
Rank 1
 asked on 14 Aug 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?