|
10 | 10 | @inject IJSRuntime JsRuntime; |
11 | 11 |
|
12 | 12 |
|
13 | | - |
14 | 13 | @*<div id="controlTree" class='e-view'></div>*@ |
15 | | -<EjsTreeView ID="controlTree" Fields="@DataSource" CssClass="@treeviewClass" FullRowSelect="true" ExpandOn="@ExpandOnSettings.Click" NodeSelected="@onNodeClick" @ref="treeView"></EjsTreeView> |
| 14 | +<EjsTreeView ID="controlTree" Fields="@DataSource" CssClass="@treeviewClass" FullRowSelect="true" ExpandOn="@ExpandOnSettings.Click" NodeSelected="@OnNodeClick" @ref="treeView"></EjsTreeView> |
16 | 15 |
|
17 | 16 |
|
18 | 17 | <div id="controlSamples" class="time-duration"> |
|
59 | 58 | }; |
60 | 59 |
|
61 | 60 |
|
62 | | - private void onNodeClick(object arg) |
63 | | - { |
64 | | - //JsRuntime.InvokeAsync<Object>("test", arg); |
65 | | - string adc = JsonConvert.SerializeObject(arg); |
66 | | - TreeViewEventModel data = JsonConvert.DeserializeObject<TreeViewEventModel> |
67 | | - (adc, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); |
68 | | - if (data.nodeData.parentID != null) |
69 | | - { |
70 | | - SampleBrowser.CurrentControl = SampleBrowser.Config.GetType().GetProperty(data.nodeData.text).GetValue(SampleBrowser.Config) as List<Sample> |
71 | | - ; |
72 | | - this.ListClass = "e-view sb-control-list-top"; |
73 | | - this.treeviewClass = "e-view time-duration sb-hide"; |
74 | | - this.ListDataSource = SampleBrowser.CurrentControl; |
75 | | - this.StateHasChanged(); |
76 | | - this.controlList.Refresh(); |
77 | | - toggle(); |
78 | | - } |
79 | | - } |
80 | | - |
81 | | - public void toggle() |
| 61 | + private void OnNodeClick(object arg) |
82 | 62 | { |
83 | | - @*JsRuntime.InvokeAsync<Object> |
84 | | - ("viewSwitch");*@ |
85 | | - if (this.treeviewClass.Contains("sb-hide")) { |
86 | | - this.treeviewClass = "e-view time-duration"; |
87 | | - this.ListClass = "sb-hide"; |
88 | | - |
89 | | - this.treeView.DataBind(); |
90 | | - } |
91 | | - @*if (this.treeviewClass != "e-view time-duration") |
| 63 | + string adc = JsonConvert.SerializeObject(arg); |
| 64 | + TreeViewEventModel data = JsonConvert.DeserializeObject<TreeViewEventModel> |
| 65 | + (adc, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); |
| 66 | + if (data.nodeData.parentID != null) |
92 | 67 | { |
93 | | - this.treeviewClass = "e-view time-duration"; |
94 | | - // this.treeView.DataBind(); |
95 | | - }*@ |
96 | | - } |
97 | | - |
98 | | - public void OnSampleSelect(Syncfusion.EJ2.RazorComponents.Lists.SelectEventArgs arg) |
99 | | - { |
100 | | - |
101 | | - string ad = JsonConvert.SerializeObject(arg); |
102 | | - ListViewEvent data = JsonConvert.DeserializeObject<ListViewEvent> |
103 | | - (ad, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); |
104 | | - List<string> |
105 | | - ls = new List<string> |
106 | | - (); |
107 | | - List<string> |
108 | | - ls1 = new List<string> |
109 | | - (); |
110 | | - if (SampleBrowser.CurrentUrl != data.data.Url) |
111 | | - { |
112 | | - if (SampleBrowser.ActionDescription != null) |
113 | | - { |
114 | | - foreach (string element1 in SampleBrowser.ActionDescription) |
115 | | - { |
116 | | - ls.Add(element1); |
117 | | - } |
118 | | - JsRuntime.InvokeAsync<Object> |
119 | | - ("updateActionDescription", ls); |
120 | | - } |
121 | | - else |
122 | | - { |
123 | | - JsRuntime.InvokeAsync<Object> |
124 | | - ("updateActionDescription", new List<string> |
125 | | - ()); |
| 68 | + SampleBrowser.CurrentControl = SampleBrowser.Config.GetType().GetProperty(data.nodeData.text).GetValue(SampleBrowser.Config) as List<Sample> |
| 69 | + ; |
| 70 | + this.ListClass = "e-view sb-control-list-top"; |
| 71 | + this.treeviewClass = "e-view time-duration sb-hide"; |
| 72 | + this.ListDataSource = SampleBrowser.CurrentControl; |
| 73 | + |
| 74 | + this.StateHasChanged(); |
| 75 | + @*this.controlList.Refresh();*@ |
| 76 | + JsRuntime.InvokeAsync<Object> |
| 77 | + ("viewSwitch", this.ListClass); |
| 78 | + @*toggle();*@ |
126 | 79 | } |
127 | | - if (SampleBrowser.Description != null) |
128 | | - { |
129 | | - foreach (string element in SampleBrowser.Description) |
130 | | - { |
131 | | - ls1.Add(element); |
132 | 80 | } |
| 81 | + |
| 82 | + public void toggle() |
| 83 | + { |
| 84 | + @*JsRuntime.InvokeAsync<Object> |
| 85 | + ("viewSwitch");*@ |
| 86 | + if (this.treeviewClass.Contains("sb-hide")) { |
| 87 | + this.treeviewClass = "e-view time-duration"; |
| 88 | + this.ListClass = "sb-hide"; |
| 89 | + this.treeView.DataBind(); |
133 | 90 | JsRuntime.InvokeAsync<Object> |
134 | | - ("updateDescription", ls1); |
| 91 | + ("viewSwitch", this.ListClass); |
| 92 | + } |
| 93 | + @*if (this.treeviewClass != "e-view time-duration") |
| 94 | + { |
| 95 | + this.treeviewClass = "e-view time-duration"; |
| 96 | + // this.treeView.DataBind(); |
| 97 | + }*@ |
135 | 98 | } |
136 | | - else |
137 | | - { |
138 | | - JsRuntime.InvokeAsync<Object> |
139 | | - ("updateDescription", new List<string> |
140 | | - ()); |
141 | | - } |
142 | | - |
143 | | - JsRuntime.InvokeAsync<Object> |
144 | | - ("destroyControl", new List<string> |
145 | | - ()); |
146 | | - |
147 | | - |
148 | | - |
149 | | - UriHelper.NavigateTo(data.data.Url); |
150 | | - SampleBrowser.CurrentUrl = data.data.Url; |
151 | | - |
152 | | - } |
153 | | - } |
154 | | - |
155 | | - |
156 | | - [Parameter] |
157 | | - private object ListDataSource { get; set; } |
158 | | - |
159 | | - protected override void OnAfterRender() |
160 | | - { |
161 | | - ListDataSource = this.controlList.DataSource = SampleBrowser.CurrentControl; |
162 | | - this.controlList.DataBind(); |
163 | | - SampleBrowser.CurrentControl.ForEach(f => |
164 | | - { |
165 | | - if (f.Name == SampleBrowser.CurrentSampleName) |
166 | | - { |
167 | | - SampleBrowser.CurrentUrl = f.Url; |
168 | | - } |
169 | | - }); |
170 | | - } |
171 | | - |
172 | | - object ListFields = new |
173 | | - { |
174 | | - id = "UID", |
175 | | - groupBy = "Category", |
176 | | - text = "Name", |
177 | | - sortBy = "Order" |
178 | | - }; |
179 | 99 |
|
180 | | - } |
| 100 | + private void OnSampleSelect(Syncfusion.EJ2.RazorComponents.Lists.SelectEventArgs arg) |
| 101 | + { |
| 102 | + string compareUrl=""; |
| 103 | + string ad = JsonConvert.SerializeObject(arg); |
| 104 | + ListViewEvent data = JsonConvert.DeserializeObject<ListViewEvent> |
| 105 | + (ad, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }); |
| 106 | + List<string> ls = new List<string>(); |
| 107 | + List<string> ls1 = new List<string>(); |
| 108 | + if (SampleBrowser.CurrentUrl != data.data.Url || data.data.Url != compareUrl ) |
| 109 | + { |
| 110 | + compareUrl = SampleBrowser.CurrentUrl; |
| 111 | + if (SampleBrowser.ActionDescription != null) |
| 112 | + { |
| 113 | + foreach (string element1 in SampleBrowser.ActionDescription) |
| 114 | + { |
| 115 | + ls.Add(element1); |
| 116 | + } |
| 117 | + JsRuntime.InvokeAsync<Object> |
| 118 | + ("updateActionDescription", ls); |
| 119 | + } |
| 120 | + else |
| 121 | + { |
| 122 | + JsRuntime.InvokeAsync<Object> |
| 123 | + ("updateActionDescription", new List<string> |
| 124 | + ()); |
| 125 | + } |
| 126 | + if (SampleBrowser.Description != null) |
| 127 | + { |
| 128 | + foreach (string element in SampleBrowser.Description) |
| 129 | + { |
| 130 | + ls1.Add(element); |
| 131 | + } |
| 132 | + JsRuntime.InvokeAsync<Object> |
| 133 | + ("updateDescription", ls1); |
| 134 | + } |
| 135 | + else |
| 136 | + { |
| 137 | + JsRuntime.InvokeAsync<Object> |
| 138 | + ("updateDescription", new List<string> |
| 139 | + ()); |
| 140 | + } |
| 141 | + |
| 142 | + JsRuntime.InvokeAsync<Object> |
| 143 | + ("destroyControl", new List<string> |
| 144 | + ()); |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + UriHelper.NavigateTo(data.data.Url); |
| 149 | + SampleBrowser.CurrentUrl = data.data.Url; |
| 150 | + |
| 151 | + } |
| 152 | + } |
| 153 | + |
| 154 | + |
| 155 | + [Parameter] |
| 156 | + private object ListDataSource { get; set; } |
| 157 | + |
| 158 | + protected override void OnAfterRender() |
| 159 | + { |
| 160 | + ListDataSource = this.controlList.DataSource = SampleBrowser.CurrentControl; |
| 161 | + this.controlList.DataBind(); |
| 162 | + SampleBrowser.CurrentControl.ForEach(f => |
| 163 | + { |
| 164 | + if (f.Name == SampleBrowser.CurrentSampleName) |
| 165 | + { |
| 166 | + SampleBrowser.CurrentUrl = f.Url; |
| 167 | + } |
| 168 | + }); |
| 169 | + } |
| 170 | + |
| 171 | + object ListFields = new |
| 172 | + { |
| 173 | + id = "UID", |
| 174 | + groupBy = "Category", |
| 175 | + text = "Name", |
| 176 | + sortBy = "Order" |
| 177 | + }; |
| 178 | + |
| 179 | + } |
0 commit comments