Telerik Forums
UI for ASP.NET MVC Forum
12 answers
1.2K+ views
Hi,

Need help to find the best way to apply filter in links - or a different method if that's better.

This is what I want.
I have a page that shows a lot of names, and when clicking on a name, another page should appear showing details for that particular name.
My initial thought was, that this is done by filtering, right !!
Using filters, also allow the user to cancel the restrictions or change filter options, if desired.
I still think this is the right way, I just don't know how.

I have played around with action links:
...ClientTemplate(@Html.ActionLink("#=Company.Name#", MVC.Company.ActionNames.Index, MVC.Company.Name, new { id = "#=Company.Id#" }).ToHtmlString());
-which gives the following URL: "http://localhost:65398/Company/Index/12345".
It would then be possible to save this ID in a session variable and then load it when the AJAS request arrive and then apply the extra FilterDescription to the list of filters, but it's still a hack.

I guess I have to find a way to add the filter parameters to the URL so kendo grid recognize it as a filter.
Any help would be appreciated.
Thanks.
Vladimir Iliev
Telerik team
 answered on 17 Mar 2015
13 answers
475 views
Hi,

I'm using the Kendo UI ASP.NET MVC Grid with a Custom Template which includes a DropDownList in a column. The data must be loaded based on different filters, so I populate the DropDownList via a DataSource.

Everything works fine, except if I do not change the value.
These are the steps:
* The grid is loaded, there is no option label, so the first entry is visible.
* If I change the value in the DropDownList, everything works fine and the value is sent to the Server
* If I do not change the value, I get null as value on the server.

It seems like the initial value is not sent back to the server.

What can I do about this? My Kendo Version is 2012.3.1114.

Greets

Attached my custom template in the grid:
@(Html.Kendo().DropDownListFor(m => m)
    .Name("SalesRep")
    .DataSource(
        config => config.Read(read => read.Action("SalesRepRead", "TemplateData", new { area = "" }).Data("filterGrid")))
    .DataValueField("Value")
    .DataTextField("Text")   
)
Kelso
Top achievements
Rank 1
 answered on 17 Mar 2015
3 answers
533 views
Currently using version 2014.3.1411.

I am trying to always filter on the "contains" operator for string columns in my grid.

The problem is that when I start typing in any of the the filters, a request is sent to the 
DataSource Read with the following data:

sort:page:1group:filter:Name~startswith~'t'

Then after a delay a second call is sent:

sort:page:1pageSize:5group:filter:Name~contains~'t'

The second call is correct. It has the correct pageSize and filter.

In the grid I have removed all filters except Contains and assigned an Operator("contains") to each filtered cell.

If I inspect the Filter i see this:

<input data-bind="value: value" data-role="autocomplete" data-text-field="Name" data-filter="startswith" data-delay="100" data-min-length="1" data-value-primitive="true" type="text" class="k-input" autocomplete="off" role="textbox" aria-haspopup="true" aria-disabled="false" aria-readonly="false" aria-autocomplete="list" aria-owns="" style="width: 100%;" aria-busy="false"><br>

This is the grid:

@helper RenderProductsSearch()
{
    @(Html.Kendo().Grid<ViewableSelectableProduct>()
              .Name("grid-products-search-#=ID#")
              .AutoBind(true)
              .Pageable(pager => pager
                    .Input(true)
                    .Numeric(true)
                    .Info(true)
                    .PreviousNext(true)
                    .Refresh(true)
                    .PageSizes(true)
              )
              .Scrollable()
              .Sortable()
              .Navigatable()
              .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
              .HtmlAttributes(new { style = "height: 100%; border: 0;" })
              .Columns(columns =>
              {
                  columns.Bound(e => e.Name).Width(300).Title("name").Filterable(f => f.Cell(cell => cell.Operator("contains").ShowOperators(false).Delay(100)));
                  columns.Bound(e => e.Sku).Width(200).Title("sku").Filterable(f => f.Cell(cell => cell.Operator("contains").ShowOperators(false).Delay(100)));
                  columns.Bound(e => e.ShortDescription).Title("description").Filterable(f => f.Cell(cell => cell.Operator("contains").ShowOperators(false).Delay(100)));
                  columns.Command(command => command.Custom("Select").Click("selectProduct"))
                            .Title("commands")
                            .Width(Constants.Columns.Default.Widths.ColumnCommands);
              })
               .Filterable(filterable => filterable
                    .Extra(false)
                    .Operators(ops => ops
                        .ForString(str => str.Clear()
                            .Contains("Contains")
                            )))
              .DataSource(dataSource => dataSource
                  .Ajax()
                  .Model(model =>
                  {
                      model.Id(p => p.Id);
                      model.Field(x => x.Id).Editable(false);
                      model.Field(x => x.Name).Editable(false);
                      model.Field(x => x.Sku).Editable(false);
                      model.Field(x => x.ShortDescription).Editable(false);
                  })
                  .PageSize(5)
                  .Events(events =>
                  {
                      events.Error("standard_grid_error_handler");
                  })
                  //.Batch(true)
                  .ServerOperation(true)
                  .Read(read => read.Action("ReadSelectable", "Product", new { blockId = "#=ID#" }))
              )
              .ToClientTemplate()
    )
}


Why is the first call happening and why does the input data-filter contain the wrong operator?

thanks








Kyle Smith
Top achievements
Rank 1
 answered on 17 Mar 2015
10 answers
1.0K+ views
Hi,

In a Kendo.Grid... there are a lot of buttons, edit, refresh, add etc...
How do i control the buttons so e.g. the refresh button is disabled as long as a row is in edit mode and other similar situations ??

Thank you in advance.
Dimo
Telerik team
 answered on 17 Mar 2015
1 answer
428 views

Hi there,

I've created a grid which bounds on a "Special" object, which has "real" properties and a list of variable properties.

This is the (single) object:

public class DynPartView
    {
 
        Guid _Id;
        public Guid Id
        {
            get { return _Id; }
            set { _Id = value; }
        }
         
        List<Prop> _Properties;
        public List<Prop> Properties
        {
            get { return _Properties; }
            set { _Properties = value; }
        }
 
     ...snip...
 
        string _Standard;
        public string Standard
        {
            get { return _Standard; }
            set { _Standard = value; }
        }
 
        string _SelectedMKL;
        public string SelectedMKL
        {
            get { return _SelectedMKL; }
            set { _SelectedMKL = value; }
        }
 
        string _SelectedManufacturer;
        public string SelectedManufacturer
        {
            get { return _SelectedManufacturer; }
            set { _SelectedManufacturer = value; }
        }
              
        
    }
 
And this is the view:
@(Html.Kendo().Grid(Model)
    .Name("partgrid")
     
    .DataSource(dataSource => dataSource
        .Ajax()
        .Batch(true)  
        .ServerOperation(false)    
        .Model(m =>
        {
            int y;
             
            m.Id(d=>d.Id);
            m.Field(f => f.SelectedMKL);
            m.Field(f => f.SelectedManufacturer);
            m.Field(f => f.Standard).Editable(false);
 
            for (y = 0; y <= Model.PropertiesCount; y++)
                m.Field(f => f.Properties[y].Value);
                
          
 
        })
        .Read(read => read.Action("Read_DynParts", "Parts", new { typeID = _typeid, mklName = _name }))
        .Create(create => create.Action("EditingInline_Create", "Parts"))
        .Update(update => update.Action("EditingInline_Update", "Parts"))
 
    )
    .ToolBar(toolbar =>
        {
            toolbar.Create();
            toolbar.Custom().Text("Kopieren");
            toolbar.Save();
             
        })
        
        .Columns(columns =>
            {
                int j = 0;
                 
                columns.Bound(b => b.Id).Hidden();
                columns.Bound(b => b.SelectedMKL).Title("MKL");
                columns.Bound(b => b.Standard).Title("Norm");
                columns.Bound(b => b.SelectedManufacturer).Title("Hersteller");
 
                for (j = 0; j < Model.PropertiesCount; j++)
                {
                    string _title="";
                    if (Model.Count() >= 1)
                        _title = Model[0].Properties[j].Name;
 
                    columns.Bound(b => b.Properties[j].Value).Title(_title);
                         
                }
                     
                  
            })
                        
        .Resizable(r => r.Columns(true))
        .Editable(editable => editable.Mode(GridEditMode.InCell))
        .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
        .Pageable(page => page.Enabled(true).PageSizes(new int[] { 10, 30, 50, 100, 1000 }))
        .Sortable()
         
        .Selectable(sel => sel.Mode(GridSelectionMode.Single))
        .Reorderable(r => r.Columns(true))
         
)

The issue I have: If I click on a property, which is stored in Properties the value is disappearing in the editbox. If I click on a property, which is a "direct" member of the class (e.g. "SelectedMKL"), the value is correctly shown after clicking the cell.
See the Pictures attached.

How can I prevent the value from disappearing?

Greetings, Denis

Alexander Popov
Telerik team
 answered on 17 Mar 2015
7 answers
601 views

I have columns Teach%, Sch%, Cit%. My end column is Total%. My client does not want to add up the number manually and enter it as data.  They want  a row by row total of Teach%, Sch%,CIt% to be summed up in calculated Field Total%.

How can this be accomplished?

Thank you.


I have attached pic of my grid:
Vladimir Iliev
Telerik team
 answered on 17 Mar 2015
3 answers
247 views
How can I enable Tooltip only for <TD> which have "contains-data" class? The <TD> elements which do not have "contains-data" class should not open Tooltip.


@(Html.Kendo().Tooltip()
.For("#Grid")
.Filter("td.contains-data")
.ContentTemplateId("template")
.Width(400)
.Height(200)
.AutoHide(false)
.ShowOn(TooltipShowOnEvent.Click)
Dimiter Madjarov
Telerik team
 answered on 16 Mar 2015
5 answers
451 views
Hi,

I noticed when running some tests based on Daylight Savings, that any attempt to select a time during the Spring transition results in the time being set back an hour. (To see this behaviour, attempt to enter 2:30 AM on March 8, 2015).  However there are many places that do not recognize Daylight Savings even in time zones that generally do, so I was wondering if there was a way to disable this feature?

Thanks,
Kevin
Vladimir Iliev
Telerik team
 answered on 16 Mar 2015
1 answer
105 views
Is there a way to get the total of a data column for an unsaved data grid? I want to check the column total before allowing a save back to the server.
Thanks
Mitchell
Top achievements
Rank 1
 answered on 16 Mar 2015
1 answer
237 views
When i use .Mobile(MobileMode.Phone) to get the "add scheduler entry" box to open on tablet / iPhone with one press, this work fine.

However, This same option then opens strangely on the desktop, full width. I would like the desktop to open a popup window, as it would normally do if the additional .Mobile(MobileMode.Phone) was not added. The site is a responsive site and needs this functionality.

Thank you in advance...
Georgi Krustev
Telerik team
 answered on 16 Mar 2015
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
Licensing
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?