Telerik Forums
Kendo UI for jQuery Forum
4 answers
117 views
Hi guys

Is there a way to attach the same init method (beforeShow and show too) to all Views, without specifying on html? Or maybe a way to bind to an event that gets triggered from all Views?

I think a good way to solve this would be the possibility to specify the View init method through the Layout. I have many Views with the same Layout, and all of them use the same init and show method. If we could put that in the Layout, the markup would become simpler and more maintainable.

Thanks!
Petyo
Telerik team
 answered on 26 Jun 2013
1 answer
1.0K+ views
I am amending the CSS files to tailor buttons and screens to suit our company layout and it will be necessary to resize the icons depending on the amount of data on the screen.  I have made some modifications which reduce the size of the text box and text, but I cannot successfully get the image icon to shrink.  I have managed to remove the icon to just display text, but ideally I would like the button to either display the icon and text if the the button is big enough but just text if the button is small.  At the moment when text only is displayed the text is off centre.  My code for the button and the icon is as follows:
.k-button.k-button.k-button-icontext {
    /*background-position: top;*/
    font-style: normal;
    font-family: Calibri;
    font-weight: normal;
    font-size: small;
    border-image-outset: 0px;
    /*height: 16px;*/ /*font-size-adjust: inherit;*/
    vertical-align: top;
    text-align: center;
    white-space: normal;
    /*overflow: auto;*/
    margin: 0px,0px,0px,0px;
    }

.k-icon {
    /*fit:slice;*/
    /*background-image:none;*/    
    display: inline-block;
    width:auto;
    height:auto;
    background-size:contain;
}
I also have another button which does not have an icon which needs to be the same size as these buttons which is why I need generic code to suit the row height.
As you can see I was experimenting with some other options - with the current settings the icon is not being displayed although I think there is enough room.  Any suggestions of amending the code gratefully received.
Dimo
Telerik team
 answered on 26 Jun 2013
8 answers
418 views
I would love to see infinite scrolling make it into the roadmap at some point.  This is essential UI, especially on mobile and the plugins that are out there haven't really nailed it down yet.

Just a thought...
Atanas Korchev
Telerik team
 answered on 26 Jun 2013
21 answers
1.0K+ views
Hello,
how to add custom icons for the tabstrip that work with the gradients?

i tried the recommended solution but the gradients aren't working. the default icons got svg masks but i guess they're is / has to be a way to add custom icons.
thanks in advance
Ralph
Top achievements
Rank 1
 answered on 26 Jun 2013
2 answers
43 views
I try to follwer the example in example,My grid have more than five hundreds row,when I slip the mouse to select the grid cell,the web brower crashed!My grid is grouped bug not allowed to page,it is a bug of grid? How to avoid this phenomenon? How to disable the mouse to slip to select the cell,Use shortcuts ctrl+Shift is OK!
vaeaze
Top achievements
Rank 1
 answered on 26 Jun 2013
1 answer
86 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
222 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.8K+ 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
121 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
654 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
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
Drag and Drop
Application
Map
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
Filter
SPA
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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
Licensing
ScrollView
Switch
TextArea
BulletChart
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
TimePicker
FloatingActionButton
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
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?