Telerik Forums
Kendo UI for jQuery Forum
1 answer
339 views
Is there a way to have the validation token with kendo grid ?
Ignacio
Top achievements
Rank 1
 answered on 31 Oct 2013
4 answers
1.2K+ views
Is it possible to make use of the UIHint attribute on a model property such as -
[Display(Name = "Days Late"), UIHint("_DaysToDate"), ReadOnly(true)]
 
public
int? DaysLate
{ 
     get; set; 
}
In order to specify a DisplayTemplate partial as a Template for grid data?

We have a fairly generic grid HTML helper method that uses model attributes whilst binding -
private static GridBuilder<dynamic> CreateDynamicGrid<TBaseViewModelType>(this HtmlHelper helper, string gridName, string provisioningControllerName, string formActionName = "Edit",
bool checkboxRowSelect = false)
{
var type =
typeof(TBaseViewModelType);
var modelProperties =
type.GetProperties().Where(p => p.IsScaffoldable()).ToList();

var
identityProperty = type.GetProperty("Id");

var idFieldName =
string.Empty;

if (identityProperty != null)
{
idFieldName =
identityProperty.Name;
}
 
return
helper.Kendo().Grid<dynamic>()
 .Name(gridName)
.Columns(columns
=> {
columns.Template(t => t).ClientTemplate("<input
class='select-row' type='checkbox' />").HeaderTemplate(t =>
"<input class='select-all-rows' type='checkbox' />").Width(40).Visible(checkboxRowSelect);
columns.Template(t =>
t).ClientTemplate(helper.ActionLink(VisionWebResources.Action_More, formActionName,
provisioningControllerName, new { id = string.Format("#= {0} #", idFieldName) },
null).ToHtmlString()).Visible(identityProperty != null).Width("4em");
modelProperties.ForEach(p =>
columns.Bound(p.GetPrevailingType(), p.Name).Format(p.GetFormatString()).HtmlAttributes(p.GetHtmlAttributes()).Width(InitialColumnWidth));
})
 .DataSource(ds => ds.Ajax()
.PageSize(15) 
.Read(r => r.Action("Read", provisioningControllerName))
 
.Model(model =>
{
model.Id(
"Id");
foreach (var property in
modelProperties) {model.Field(property.Name, property.GetPrevailingType));
 }
 })
)
.Editable(ed =>
ed.Enabled(false))
.Events(events => events.DataBound(
"function() { "
+
 
"if (typeof (gridDataBound) === 'function') { gridDataBound(); }"  +
"}").Change("function() { " +
"
if (typeof (gridFocusedRowChanged) ===
'function') { gridFocusedRowChanged(); }" +
 "
}"))
.Filterable()
.HtmlAttributes(new { @class = "grid" })
.Navigatable()
.Pageable(pages
=>
{
    pages.PageSizes(
new[] { 15, 25, 40 });
    pages.Refresh(
true);
//Provides a button to refresh the current grid page
 })
.Resizable(resize => resize.Columns(true))
.Scrollable(scrollable =>
scrollable.Height(425))
.Selectable(selectable =>
selectable.Mode(GridSelectionMode.Single))
.Sortable(sortable =>
sortable.AllowUnsort(false));
 }

The grid has a dynamic model which is based partially on a fixed ViewModel and partially on dynamic fields which are created and managed by the users within the database (and thus cannot be known in advance). As such the binding is programmatic and not directly to a model. The dynamic fields do not require a display template, I simply wanted to provide some context around our approach.

The line that builds up the columns from the fixed ViewModel is-

modelProperties.ForEach(p => columns.Bound(p.GetPrevailingType(), p.Name).Format(p.GetFormatString()).HtmlAttributes(p.GetHtmlAttributes()).Width(InitialColumnWidth));

Can I add the "ClientTemplate" method to load a partial based on the UIHint value for the property, perhaps use @Html.DisplayFor(), or must this be explicit text?
Daniel
Telerik team
 answered on 31 Oct 2013
1 answer
148 views
Hi,

Stock chart Navigator component's labels/readings are overlapping with each other as highlighted in the attached screen shot. Please help us in resolving this issue.

 
Iliana Dyankova
Telerik team
 answered on 31 Oct 2013
1 answer
12.0K+ views
I would like my grid to be able to scroll horizontally when either the users browser is too small OR when they add additional columns using the Columns menu...

I have tried putting overflow-x:scroll on the surrounding div, but that solution has two problems.
1.) The footer (paging etc..) scroll with the data columns which looks crappy and is not wanted.
2.) The part of the grid that is not visible upon load is not styled, meaning that is has no alternating row colors on it when you start scrolling to the right.

Is there a Kendo supported Vertical scrolling property that I am missing?

Thanks
Jason
Dimo
Telerik team
 answered on 31 Oct 2013
1 answer
329 views
I was asked to hide the first or last row in the month view when all the entries on that row are actually for the next or previous month.  For example for the month of October 2013, the bottom row contains all days in November.

There is no out of the box way to do this but it's actually pretty easy.  I'd like to share my solution and get feedback, please let me know is there is a better way to do it.
//define the cells and rows
var gridCells = $("td[role='gridcell']");                            
var gridRows = $("tr[role='row']"); 
 
//figure out if we should hide the first and/or last row                       
//class will be null if it's normal, otherwise 'k-other-month'                       
if (gridCells[6].getAttribute("class") != null) { $(gridRows[0]).css("display", "none"); }                       
if (gridCells[35].getAttribute("class") != null) { $(gridRows[5]).css("display", "none"); }
I call the above code in my 'dataBound' event handler because I refresh the datasource during navigation.  The 'navigate' handler is probably more appropriate in most cases.

My only concern is that there are other possible classes for the gridcells which I am not yet aware of, which would cause the row to be unintentionally hidden.  Maybe it would be better to check if the class is not 'k-other-month' instead of just looking to see if it is not null?



Vladimir Iliev
Telerik team
 answered on 31 Oct 2013
3 answers
386 views
Hi Kendo UI Team,

I have a grid with dummy data and a client template. I'm attempting to add new records.
<div id="grid">
</div>
<script id="detail-template" type="text/kendo-ui-template">
    <div>
        <p>#: FirstName # #: LastName #'s age is #: Age #</p>
  </div>
</script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#grid").kendoGrid({
            sortable: true,
            editable: "incell",
            toolbar: ["create"],
            columns:[
                {
                    field: "FirstName",
                    title: "First Name"
                },
                {
                    field: "LastName",
                    title: "Last Name"
                }],
            dataSource: {
                schema: {
                    model: {
                        id: "Id",
                        fields: {
                            FirstName: {
                                type: "string"
                            },
                            LastName: {
                                type: "string"
                            },
                            Age: {
                                //data type of the field {Number|String|Boolean} default is String
                                type: "number",
                                // used when new model is created
                                defaultValue: 1
                            }
                        }
                    }
                },
                data: [
                    {
                        Id: 1,
                        FirstName: "Joe",
                        LastName: "Smith",
                        Age: 30
                    },
                    {
                        Id: 2,
                        FirstName: "Jane",
                        LastName: "Smith",
                        Age: 20
                    }]
            },
            detailTemplate: kendo.template($("#detail-template").html()),
            dataBound: function ()
            {
                this.expandRow(this.tbody.find("tr.k-master-row").first());
            },
        });
    });
</script>
Right now I can only edit the fields defined as grid columns, but not the field in the detail template. How can I fix this?
Alexander Popov
Telerik team
 answered on 31 Oct 2013
1 answer
288 views
If I use the theme called Metro Black and have a resource that sets the background color for the event, the text color is either black or white depending on the background color.  It is not somthing that I set, but seems to be handled in the css.  If I change the theme to Flat, the text color is always white, even if the background color of the event is white and is therefore not readable. 

Is there something I can do to make the Flat theme behave the same way as the Metro Black theme with regards to the event text color?

Thanks,
Dimo
Telerik team
 answered on 31 Oct 2013
1 answer
296 views
Hi:

I'm trying to update the majortick during runtime
I have the following:

<script type='text/javascript'>


$("#doctors").change(function () {

var scheduler = $("#scheduler").data("kendoScheduler");

 scheduler.majorTick(60); //interval of 60 minutes
 
kendo.bind($("#scheduler"), scheduler);
$("#scheduler").data("kendoScheduler").refresh();

});

</script>

Somehow, the code is not updating the intervals as a show in the code.

I appreciate in advance

John
Vladimir Iliev
Telerik team
 answered on 31 Oct 2013
1 answer
86 views
Hi Support,
We want to convert our application to HTML5. I see Kendo UI is the best solution for it, but i found that Kendo UI is only available for ASP.NET MVC base. We don't follow MVC pattern in our current application. I just want to make sure, is Kendo UI available for standard ASP.NET pages, If yes please send me that link and also online demo link, i will explore it in detail.

Thanks
Abu Sufyan
Kiril Nikolov
Telerik team
 answered on 31 Oct 2013
1 answer
392 views
As I have posted here I have a problem with setting dataItem.set() manually.

I have an editable Kendo Grid that may have a column with a checkbox to change a boolean value. I have used this solution proposed by OnaBai that is working perfectly!

The only problem is that the checkbox value change is too slow. When user clicks it, it takes about 1 second to change. I realize that the dataItem.set() method is responsible by this delay.

My grid has a considerable amount of data. About 30-40 columns and 300+ lines. It is defined as follows:

$("#mainGrid").kendoGrid({
    dataSource: dataSource,
 
    pageable: false,
    sortable: true,
 
    scrollable: true,
    editable: true,
    autoBind: false,
    columnMenu: true, // Cria o menu de exibição de colunas
    height: getGridHeight(),
 
    toolbar: [/* hide for brevity */],
    columns: [/* hide for brevity */],
    dataBound: function() { /* hide for brevity. */},
    edit: function() { /* hide for brevity. */}
});
Another detail is that, when dataItem.set() is called, it calls dataBound() event but that is not causing the delay. Grid's edit() method is not being called on this process. I don't know if worths to post dataSource code.

Any help will be very appreciate. Thank you in adv.
Kiril Nikolov
Telerik team
 answered on 31 Oct 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
DropDownTree
ListBox
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
Styling
ColorPicker
Pager
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
Licensing
PivotGridV2
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
LLM Kit
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?