This is a migrated thread and some comments may be shown as answers.

Maximize, Minimize, Refresh Button visibility based on the condition.

2 Answers 167 Views
Window
This is a migrated thread and some comments may be shown as answers.
Prakash
Top achievements
Rank 1
Prakash asked on 18 Sep 2012, 04:48 AM

I am loading kendo window during runtime using javascript and window configurations like title, height, width, url everything coming from JSON object.
Same like I am trying to pass the maximize, minimize, and refresh buttons visibility configuration from JSON.
Not able to handle buttons configuration the below code.

Please let me know any other choice to handle this?
Sample code:
var jsonDoc = {
  widget: [{name:"W1",
    title: "W1",
    height: 200,
    width: 320,
    url:"http://jsbin.com"
    maximize:true
    refresh:true
    minimize:false }]
    };
for (var i = 0, sl = jsonDoc.widget.length; i < sl; i++)
         {
            var panelname;
            panelname = "#panel" + i;
            $(panelname).kendoWindow(
            {
               title: jsonDoc.widget[i].title,
               height: jsonDoc.widget[i].height,
               width: jsonDoc.widget[i].width,
               actions: [????],
               content: jsonDoc.widget[i].url
             });
           $(panelname).parents('.k-window').css('top', '45%');
           }

2 Answers, 1 is accepted

Sort by
0
Accepted
Nohinn
Top achievements
Rank 1
answered on 18 Sep 2012, 07:39 AM
Create an array before the kendoWindow instance where you add as many actions as you need, for example:
P.S: From JSON you just need to send an array (or List<string> if you're working with .NET) containing the values for the actions "Close", "Maximize", "Minimize", "Refresh" and bind this array to the actions parameter of the kendoWindow.
for (var i = 0, sl = jsonDoc.widget.length; i < sl; i++)
         {
            var actions = [];
            if(i % 2 == 0) actions.push("Minimize");
            else actions.push("Maximize");
            actions.push("Close");
            var panelname;
            panelname = "#panel" + i;
            $(panelname).kendoWindow(
            {
               title: jsonDoc.widget[i].title,
               height: jsonDoc.widget[i].height,
               width: jsonDoc.widget[i].width,
               actions: actions,
               content: jsonDoc.widget[i].url
             });
           $(panelname).parents('.k-window').css('top', '45%');
           }
0
Prakash
Top achievements
Rank 1
answered on 18 Sep 2012, 08:02 AM

Nohinn ,Thanks lot for your quick & correct response
Tags
Window
Asked by
Prakash
Top achievements
Rank 1
Answers by
Nohinn
Top achievements
Rank 1
Prakash
Top achievements
Rank 1
Share this question
or