Telerik Forums
Kendo UI for jQuery Forum
1 answer
430 views
Hello

I'm using the ListView to display different items. The item should have a different back color depending on the status of the item.
I was able to change the background-color of a element within the <li> by doing something like this:
<div ${data.Status == 0 ? "style=\"background-color:orange;\"" : (data.Status == 1 ? "style=\"background-color:darkred\"" : "style=\"background-color:darkgreen\"")}></div>
But here I still have the borders of the <li> element. Therefore I would like to set the background-color directly in the <li> element to solve the issue.

Is there a way to set the background-color of the ListItem depending on my Status-Property?

I found a way how to access the css of the parent.
http://stackoverflow.com/questions/258317/jquery-changing-background-of-parent-div 
But somehow I wasn't able to use this in the template.

Thanks in advance!

Kind Regards
Bruno
Kamen Bundev
Telerik team
 answered on 02 Aug 2012
1 answer
437 views
Hi,
I am trying to create a ListView with remote json/jsonp databinding for Kendo mobile.
I have seen the databinding demo (http://demos.kendoui.com/mobile/listview/databinding.html), but I can't seem to convert it into a json/jsonp web service.
I also tried with the non-mobile Kendo Web remote binding (http://demos.kendoui.com/web/datasource/remote-data.html) which works great by itself, but not in a Kendo mobile application.

is there a demo similar to the Kendo mobile ListView databinding demo (http://demos.kendoui.com/mobile/listview/databinding.html), but with a json/jsonp web service?

Many thanx
Ran
Ran
Top achievements
Rank 1
 answered on 02 Aug 2012
0 answers
93 views
what is the best way to handle the combobox request when serverFilter is true
how to bind filter[filters][0][field] in mvc3 like DataSourceRequest for kendo grid
Ibrahim
Top achievements
Rank 1
 asked on 02 Aug 2012
5 answers
3.6K+ views

I'm having a problem trying to set the Grid's datasource after the grid has been created.  Here is what I currently have, I've tried a bunch of diffenent vatiations of it, but none have worked.  I can see from the Dev Tools in IE9 that its making the service call.  

$(document).ready(function() {
    
    grid = $("#grid").kendoGrid({
        dataSource: {
               pageSize: 10
           },
           height: 800,
           scrollable: true,
           sortable: true,
           filterable: true,
           pageable: {
               input: true,
               numeric: false
           },
           columns: [
               {
                   field: "UnitId",
                   title: "ID"
               },
               {
                   field: "UnitName",
                   title: "Name",
                   width: 200
               },
               {
                   field: "Location",
                   width: 200
               },
               {
                   field: "Number",
                   title: "Number"
               },
               {
                   field: "Rating"
               },
               {
                   field: "Date",
                   title: "Date"
               }
           ]
       });
 
        setDataSource()
   });
 
 
    
       function setDataSource() {
           //check if the data is in the db
 
           var dataSource = new kendo.data.DataSource({   
               type: "json",
               transport: {
                   read: {
                       url: "http://localhost/DashboardServices/api/Assessments",
                       complete: function(e){ debugger; $("#grid").data("kendoGrid").dataSource.data(e); $("#grid").data("kendoGrid").dataSource.read();}
                   }
               },
               schema: {
                   model: {
                       fields: {
                           UnitId: { type: "string" },
                           UnitName: { type: "string" },
                           Location: { type: "string" },
                           Number: { type: "string" },
                           Rating: { type: "string" },
                           Assessed: { type: "date" }
                       }
                   }
               },
           });
 
       }
Atanas Korchev
Telerik team
 answered on 02 Aug 2012
18 answers
998 views
How do I change the contentUrl on a splitter pane...on an event, so the splitter is already defined, I want to change it based on a click event.

So the idea is the splitter pane is collapsed and not resizable on load...click an item, it becomes expanded, changes to resizable and collapsable, and gets a contentURL set based on the value passed in.

(also API lists contentURL as a Bool?)
contentUrl: Boolean(default: true)
charan
Top achievements
Rank 1
 answered on 02 Aug 2012
0 answers
245 views
How can I select one item from a ListView and move to another ListView. List Item can be  selected and removed easily. But how can I add selected listItem to another ListView.
Sanjeev
Top achievements
Rank 1
 asked on 02 Aug 2012
2 answers
570 views
When using the following view code, I can't seem to find where I should be setting the type to POST so that it will reach back to the controller methods. 

Right now, if I put the [HttpPost] tag above the method, I get a 404 Not found error when I execute that method.  If I don't have the post tag, then I reach the method but the parameters are empty (Not null, just an empty, but instantiated object).

All of the examples I've seen have [HttpPost] or [AcceptVerbs(HttpVerbs.Post)] above the method.  I've tried both and can't get it to work.

Error:
HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.


Controller:
//Other CRUD omitted for brevity
        [HttpPost]
        public ActionResult CreateProducts([DataSourceRequest]DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<Models.ItemModel> itemsToAdd)
        {
            Models.ShipmentModel shipmentModel = SessionModel;
 
            foreach (Models.ItemModel newItem in itemsToAdd)
            {
 
                if (shipmentModel.ItemModelList.Count > 0)
                {
                    var nextID = (from i in shipmentModel.ItemModelList
                                  select i.ItemID).Max() + 1;
 
                    newItem.ItemID = nextID;
                }
 
                shipmentModel.ItemModelList.Add(newItem);
            }
 
            var items = shipmentModel.ItemModelList;
            DataSourceResult result = items.ToDataSourceResult(request);
            return Json(result, JsonRequestBehavior.AllowGet);
        }

View
<div id="ShipmentForm">
@(Html.Kendo().Grid<KendoUITestEnvironment.Models.ItemModel>()
    .Name("QuoteItemGrid")
    .Columns(columns =>
    {
        columns.Bound(i => i.FreightClass).Width(50);
        columns.Bound(i => i.Length).Width(50);
        columns.Bound(i => i.Width).Width(50);
        columns.Bound(i => i.Height).Width(50);
        columns.Bound(i => i.DimensionUnitOfMeasure).Width(50);
        columns.Bound(i => i.QuantityValue).Width(50);
        columns.Bound(i => i.QuantityUnitOfMeasure).Width(50);
        columns.Bound(i => i.Weight).Width(50);
        columns.Bound(i => i.WeightUnitOfMeasure).Width(50);
        columns.Bound(i => i.NmfcCode).Width(50);
        columns.Bound(i => i.ItemDescription).Width(50);
        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("QuoteItemGrid_ErrorHandler"))
        .Model(model =>
        {
            model.Id(i => i.ItemID);
            model.Field(i => i.FreightClass);
        })
        .Create(create => create.Action("CreateProducts", "Home"))
        .Read(read => read.Action("GetProducts", "Home"))
        .Update(update => update.Action("UpdateProducts", "Home"))
        .Destroy(destroy => destroy.Action("DeleteProducts", "Home"))
    )
)
</div>
im
Top achievements
Rank 2
 answered on 01 Aug 2012
1 answer
150 views
Hi everyone,

I am working on creating cascading combo boxes. I would like to use a data that is being pre-loaded as C# objects, which then will be convert into JSON model and use as a datasource.

I looked at the example code from the cascading combo box demo and realized that it uses Odata points to some web service, which return a large xml-liked file content, which gives me a bit of difficult time understanding how the 1st combo box can be used to determine what get to be displayed on the 2nd combo box.

So if we take cascading combo boxes for country and state as an example. If I were to have the first combo box as a country like this.

        $(".country-combo-box").kendoComboBox({
            dataTextField: "text",
            dataValueField: "value",
            dataSource: [
                { text: "United States of America", value: "US" },
                { text: "Canada", value: "CA" },
                { text: "United Kingdom", value: "UK" },
                { text: "France", value: "FR" }
            ],
            filter: "contains",
            suggest: true,
            index: 0
        });

How would I set up the 2nd combo box, so that if I select the US as a country  and expect the 2nd combo to display on the states that belong to the US although technically the datasource for the 2nd combo box should contains all states for every country?

Would the datasource for the 2nd combo box looks like this? 
 dataSource: [
                { country: "US", text: "New York", value: "NY" },
                { country: "US", text: "Texas", value: "TX" }, 
                { country: "US", text: "Florida", value: "FL" }, 
                { country: "CA", text: "Alberta", value: "AL" }, 
            ], 
If so, how do I set the filter on the 2nd combo box to only select all states for a specific country?

I appreciate your time helping me on this. 

Thank you very much,

Patt






 
Patt
Top achievements
Rank 1
 answered on 01 Aug 2012
1 answer
125 views
I believe I may have found a bug in the class assignment of spans when using a Grid with inline editing. When adding a new record with a field that is designated as a number, I get a textbox with arrow on the right to adjust the value up or down. Both arrows that are appearing are up arrows. I looked at the rendered code and saw the following:

<span class="k-select">
  <span unselectable="on" class="k-link">
    <span unselectable="on" class="k-icon k-i-arrow-n" title="Increase value">Increase value</span>
  </span>
  <span unselectable="on" class="k-link">
    <span unselectable="on" class="k-icon k-i-arrow-s" title="Decrease value">Decrease value</span>
  </span>
</span>

notice the "k-i-arrow-n" and "k-i-arrow-s" classes. These are not located in the CSS file. I changed the classes to "k-arrow-up" and "k-arrow-down" and the arrows rendered properly.

I've added local style definitions on my page to correct this, but thought I would let you know to update the code. Thanks.
Philip Senechal
Top achievements
Rank 1
 answered on 01 Aug 2012
0 answers
79 views
Is there a way to have a column in a grid lets say the first column to move along with the scroll bar and always be the first column like in excel. Any help regarding this is much appreciated.
Kavitha
Top achievements
Rank 1
 asked on 01 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?