Telerik Forums
Kendo UI for jQuery Forum
1 answer
638 views

I am using kendo grid on multiple elements throughout my app. I want to do few changes wherever any grid is loaded fully.

Is there a way to write common function for all grids before grid is loaded ?

for ex - 

<script>

function afterGridRendered(){};
// code to bind above method to all grids 

$("#grid").kendoGrid({
            ...
        });

</script>

Ivan Danchev
Telerik team
 answered on 24 Aug 2020
2 answers
515 views

Hi. I'm using a kendo grid backed by a datasource to display some information. The configuration for one field in this datasource can be saved to a database and reloaded (the field is called 'isActive'). I am doing this by fetching the values from a database, looping over them, getting the corresponding dataItem from the dataSource and setting it like so:

//pseudocode

for each (f in filters) {

    if (!f.isActive){

         dataItem.set("isActive", false);

    }

}

The issue is that the time it takes to set a dataItem is between 3 and 5 seconds and I will sometimes be doing this for 100s of items, so it can be very slow. In the demo for setItem it runs much faster, I'm not sure what is different. Getting the dataItem takes a fraction of a second. Is there a faster way to achieve this? I have no idea why it is taking so long

Thanks.

 

Nikolay
Telerik team
 answered on 24 Aug 2020
5 answers
157 views
function GetWarehouseReleationByWarehouseId() {<br>    $.AjaxData.push({ key: 'WarehouseId', value: selectedWarehouse_OnWarehouseManagement.Id });<br>    AjaxTransactions(<br>        '../Warehouse/GetAllWarehouseRelationList/',<br>        $.AjaxData,<br>        function (result) {<br>            selectedWarehouseReleationData = result.Objects;<br><br>            KendoData('grdWarehouse_OnWarehouseRelation').dataSource.data([]);<br>            $.each(selectedWarehouseReleationData, function (index, data) {<br>                <br>                debugger;<br>                KendoData('grdWarehouse_OnWarehouseRelation').dataSource.add({<br>                    Id: data.Id,<br>                    Warehouse: { Id:1,WarehouseName:'test'},<br>                    ProcessType: { Value: data.WarehouseRelationProcessTypeId }<br>                   <br>                });              <br>            });<br><br>        }, 'post', 'json', false, false);<br>};

This My JavaScript fonks I set Value ınline Grid Combobox Here!!


    grid._schemaMethod = {<br>        model: {<br>            id: 'Id',<br>            fields: {<br>                Warehouse: { defaultValue: { Id: '', WarehouseName: '' } },<br>                ProcessType: { defaultValue: { Value: '', Text: '' } },<br>            }<br>        }<br>        };<br>    grid._columns.push(grid.GridColumn('Id', null, '200px', null, null, null, null, null, null, null, true));<br>    grid._columns.push(grid.GridColumn('Warehouse', Field_RelatedWarehouse, '200px', null, "#=Warehouse.WarehouseName#", null, null, null, null, null, null, null, null, null, RelatedWarehouseEditor));<br>    grid._columns.push(grid.GridColumn('ProcessType',Field_ProcessType, '200px', null, "#=ProcessType.Text#", null, null, null, null, null, null, null, null, null, ProcessTypeEditor));<br>    grid._columns.push(grid.GridColumn(null, '&nbsp;', '200px', { style: 'text-align:right' }, null, null, null, null, null, null, null, null, null, ['edit', 'destroy']));


This Part my Inlıne grid !!

 

1.function ProcessTypeEditor(container, options) {<br><br>    var processType = [<br>        { "Text": "Transfer" , 'Value': 1 },<br>        { "Text": "Talep" , 'Value': 2 }<br>    ];<br>    $('<input name="' + options.field + '"/>')<br>        .appendTo(container)<br>        .kendoComboBox({<br>            autoBind: false,<br>            dataTextField: "Text",<br>            dataValueField: "Value",<br>            dataSource: { data: processType },<br>        });<br>};<br>function RelatedWarehouseEditor(container, options) {<br><br>    GetWarehouseListByFacilityId();<br><br>    $('<input name="' + options.field + '"/>')<br>        .appendTo(container)<br>        .kendoDropDownList({<br>            autoBind: true,<br>            dataTextField: "WarehouseName",<br>            dataValueField: "Id",<br>            dataSource: { data: warehouseList_OnContactInfo },<br>        });<br>};

And I this Combobox Value 

 

What Can I now I cant set my result to combobox Can you Help Me ? !  !!

Eyup
Telerik team
 answered on 21 Aug 2020
12 answers
2.5K+ views

Hey

I have problem with the grid his not showing createdTime  Why ? I so Tired for searching solution  plzz help me Im beginner  In  kendo and that my code :

View :
@(Html.Kendo().Grid<appfox.Models.Address>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.AddressLine1);
            columns.Bound(p => p.AddressLine2).Visible(false);
            columns.Bound(p => p.AddressPostalCode);
            columns.Bound(p => p.CreatedDate).Format("{0:dd-MM-yyyy}").EditorTemplateName("Date");
            columns.Bound(p => p.CreatedTime).Format("{0:HH:mm:ss}").EditorTemplateName("Date");
            columns.Command(command => command.Custom("ViewDetails").Click("showDetails")).Width(180);


        })
                   .Resizable(resize => resize.Columns(true))
                    .Reorderable(reorder => reorder.Columns(true))
        .HtmlAttributes(new { style = "height: 380px;" })
        .Scrollable()
        .Groupable()
            .Sortable()
            
        
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(dataSource => dataSource
            .Ajax()
                   .Model(model =>
                    {
                        model.Field(x => x.AddressId).Editable(false);
                        model.Id(x => x.AddressId);


                    })
            .Read(read => read.Action("List", "Test"))
            
            )
 

)

@(Html.Kendo().Window().Name("Details")
    .Title("Customer Details")
    .Visible(false)
    .Modal(true)
    .Draggable(true)
        .LoadContentFrom("List", "Test")
    .Width(300))

_____________________________________________________________________________________

Class:

 public partial class Address
    {
        public int AddressId { get; set; }
        public string AddressLine1 { get; set; }
        public string AddressLine2 { get; set; }
        public Nullable<byte> AddressPostalCode { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Country { get; set; }
        public string TimeZone { get; set; }
        public string CreatedBy { get; set; }
        public System.DateTime CreatedDate { get; set; }
        public System.TimeSpan CreatedTime { get; set; }
        public string UpdatedBy { get; set; }
        public System.DateTime UpdatedDate { get; set; }
        public System.TimeSpan UpdatedTime { get; set; }
    }
}

 

Controller 

        public ActionResult Index1([DataSourceRequest]DataSourceRequest request)
        {
            List<Address> omList = new List<Address>();
            Address om = new Address();


            using (Test1Entities objContext = new Test1Entities())
            {
                var q = objContext.Address.ToList();
                omList = getOrders(q);

                DataSourceResult result = omList.ToDataSourceResult(request);
                return View(result);

                // return omList;
            }


        }

        private List<Address> getOrders(List<Address> olist)
        {
            List<Address> omList = new List<Address>();
            foreach (var ads in olist)
            {
                Address o = new Address();
               
                o.AddressLine1 = ads.AddressLine1;
                o.AddressLine2 = ads.AddressLine2;
                o.AddressPostalCode = ads.AddressPostalCode;
                o.City = ads.City;
                o.State = ads.State;
                o.Country = ads.Country;
                o.TimeZone = ads.TimeZone;
                o.CreatedBy = ads.CreatedBy;
                o.CreatedDate = ads.CreatedDate;
                omList.Add(o);
            }

            return omList;
        }

        public ActionResult List([DataSourceRequest]DataSourceRequest request)
        {
            List<Address> omList = new List<Address>();
            Address om = new Address();


            using (Test1Entities objContext = new Test1Entities())
            {
                var q = objContext.Address.ToList();
                omList = getOrders(q);

                DataSourceResult result = omList.ToDataSourceResult(request);
                return Json(result, JsonRequestBehavior.AllowGet);

                // return omList;
            }
        }

Tsvetomir
Telerik team
 answered on 20 Aug 2020
5 answers
922 views

Hi ,

 

I have below scenarion

I am loading  text box  dropdown and switch in Grid in load, i need to maintain the selected values or entered values after the grid refresh

Is there any way to maintain

 

Anton Mironov
Telerik team
 answered on 20 Aug 2020
5 answers
172 views

when splitter moved to the right, Gantt's header's width was expanded,but  The  Width of Gantt's timeLine was not expanded.

I think the automatically calculated timeline width of the Gantt chart is wrong

How can I solve this situation?

 

ps Add another picture.

Neli
Telerik team
 answered on 19 Aug 2020
3 answers
476 views

Hi Team,

We are facing issue with exported PDF.

We are not able to get print out from the exported PDF file.

When we try to get print out then only small portion from the pdf is printed on single page.

Please help us how we can take print out from exported PDF.

Thanks!

Aleksandar
Telerik team
 answered on 19 Aug 2020
1 answer
186 views

I'm using the cellClose event to update cell values, it works within the values in the selected row. I have a last row called Total which is the sum of the Values of the Column D
----------Column_A Column_B Column_C Column_D
----------Product1---ValueB1---ValueC1-------ValueD1
----------Product2---ValueB2---ValueC2-------ValueD2
----------Total------------------------------------------ValueT
Column D= Column_C * Column_B and ValueT = ValueD1 + ValueD2
When i update ValueC1 or ValueB1 , ValueD1 gets updated and re-rendered with the new value . The problem is that the ValueT gets udpated but it doesnt re-render .
The code i have is this one :

cellClose:function(e){<br>    var dataItem=e.sender.dataItem($(e.container).parent())// getting the current edited row<br>    var aux= e.sender.dataSource.data(); //getting all rows<br>    var dataTotal= aux[aux.length-1]; //geting total row<br>    <br>    valueB=dataItem["Column_B"];<br>    valueC=dataItem["Column_C"];<br>    dataItem.set("Column_D",valueB*ValueC);<br>    <br>      var sum=0;<br>       for (let i=0;i<aux.length-1;i++)//getting sum of values of Column_D<br>       {<br>               sum=sum+aux[i].Column_D;<br>       } <br>      dataTotal.set("Column_D",sum) // setting sum<br>    <br>    <br>    } <br>

 

Petar
Telerik team
 answered on 19 Aug 2020
1 answer
93 views

I'm using the cellClose event to update cell values, it works within the values in the selected row. I have a last row called Total which is the sum of the Values of the Column D
----------Column_A Column_B Column_C Column_D
----------Product1---ValueB1---ValueC1-------ValueD1
----------Product2---ValueB2---ValueC2-------ValueD2
----------Total------------------------------------------ValueT
Column D= Column_C * Column_B and ValueT = ValueD1 + ValueD2
When i update ValueC1 or ValueB1 , ValueD1 gets updated and re-rendered with the new value . The problem is that the ValueT gets udpated but it doesnt re-render .
The code i have is this one :

 

cellClose:function(e){
var dataItem=e.sender.dataItem($(e.container).parent())// getting the current edited row
var aux= e.sender.dataSource.data(); //getting all rows
var dataTotal= aux[aux.length-1]; //geting total row
 
valueB=dataItem["Column_B"];
valueC=dataItem["Column_C"];
dataItem.set("Column_D",valueB*ValueC);
 
  var sum=0;
   for (let i=0;i<aux.length-1;i++)//getting sum of values of Column_D
   {
           sum=sum+aux[i].Column_D;
   }
  dataTotal.set("Column_D",sum) // setting sum
 
 
}
Petar
Telerik team
 answered on 19 Aug 2020
1 answer
4.0K+ views
I'm grouping the grid through the datasource and I want to hide the left-most column, the one I so poorly highlight in my screenshot.  That's just a test grid, but it represents the column I want removed.   Removing  .k-group-cell will remove it but that messes up the colspan of the row.  Even decreasing the width will suffice but that attribute doesn't seem to take affect.

Dimo
Telerik team
 answered on 19 Aug 2020
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
Application
Map
Drag and Drop
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
MultiColumnComboBox
Dialog
Chat
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Effects
Accessibility
PivotGridV2
ScrollView
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Breadcrumb
Collapsible
Localization
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
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
+? more
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Top achievements
Rank 1
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ivory
Top achievements
Rank 1
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
YF
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?