提交 | 用户 | age
|
25ab64
|
1 |
// ----------------------------------------------------------------------------------------------------------- |
F |
2 |
// Functions for deleting rows |
|
3 |
// ----------------------------------------------------------------------------------------------------------- |
|
4 |
MS.Delete; |
|
5 |
// ----------------------------------------------------------------------------------------------------------- |
|
6 |
// Marks row as deleted, helper function to DeleteRow, due recursion |
|
7 |
// If noshow == true, dows not color the row |
|
8 |
// Type = 0 all Deleted = 1, = 1 Deleted==0 => Deleted=2, =2 Deleted==2 => Deleted=0 |
|
9 |
TGP.MarkRowDeleted = function(row,del,noshow,remove,recur){ |
|
10 |
if(!recur && !this.MasterGrid) this.UndoStart(); |
|
11 |
for(var r=row.firstChild;r;r=r.nextSibling) this.MarkRowDeleted(r,del,noshow,remove,1); |
|
12 |
if(recur && (del && row.Deleted || !del && row.Deleted!=2)) return; |
|
13 |
if(recur && del) del = 2; |
|
14 |
if(!this.MasterGrid) { |
|
15 |
var n = row.parentNode.Page ? this.GetNextSibling(row) : row.nextSibling; |
|
16 |
this.AddUndo({ Type:"Delete",Row:row,Del:del,Deleted:row.Deleted,Expanded:row.Expanded,Def:row.Def.Name,ParentId:row.parentNode.id,NextId:n?n.id:null,Page:row.parentNode.Page,Removed:remove }); |
|
17 |
} |
|
18 |
if(this.SaveOrder && !Is(row,"NoUpload") && !row.CPage) this.SetChange({ Row:row.id,Deleted:del }); |
|
19 |
var par = row.parentNode; |
|
20 |
if(!del && !par.Page && Get(par,"DefParent") && !this.HasNDChildren(par)) this.ChangeDef(par,Get(par,"DefParent"),!noshow,2); |
|
21 |
row.Deleted = del; |
|
22 |
if(this.ClearSelected&1){ |
|
23 |
if(row.Selected&this.SelAnd) { |
|
24 |
row.Deleted = 0; |
|
25 |
if(this.CanSelect(row)) this.SelectRow(row,0,0,1); |
|
26 |
row.Deleted = del; |
|
27 |
} |
|
28 |
if(this.ShowDeleted) this.UpdatePanel(row); |
|
29 |
} |
|
30 |
if(del && !par.Page && Get(par,"DefEmpty") && !this.HasNDChildren(par)) this.ChangeDef(par,Get(par,"DefEmpty"),!noshow,2); |
|
31 |
if(del && Grids.OnRowDelete) Grids.OnRowDelete(this,row,del); |
|
32 |
if(!del && Grids.OnRowUndelete) Grids.OnRowUndelete(this,row); |
|
33 |
MS.Pivot; |
|
34 |
if(this.PivotGrid) this.DelPivotRow(row,del); |
|
35 |
if(this.PivotDetail) for(var id in this.PivotDetail) this.PivotDetail[id].DelPivotDetailRow(row,del); |
|
36 |
ME.Pivot; |
|
37 |
MS.Gantt; MS.GanttDependencies; |
|
38 |
if(del && this.GanttDelDep) { |
|
39 |
this.DeleteDependencies(this.GetDependencies(row,this.GanttDelDep)); |
|
40 |
var gc = this.GetFirstGantt(); |
|
41 |
var anc = this.GetGanttCol(row,gc,"Ancestors"); if(anc && row[anc]) this.SetValue(row,anc,this.CheckGantt(row,anc,""),1); |
|
42 |
var des = this.GetGanttCol(row,gc,"Descendants"); if(des && row[des]) this.SetValue(row,des,this.CheckGantt(row,des,""),1); |
|
43 |
} |
|
44 |
ME.GanttDependencies; ME.Gantt; |
|
45 |
if(!noshow && this.ColorState&2) this.ColorRow(row); |
|
46 |
MS.Master; if(!noshow && row.DetailRow) this.MarkDetailRowDeleted(row,del); ME.Master; |
|
47 |
if(!noshow && this.GanttDependency) this.Recalculate(row,null,!noshow); |
|
48 |
if(!recur && !this.MasterGrid) this.UndoEnd(); |
|
49 |
} |
|
50 |
// ----------------------------------------------------------------------------------------------------------- |
|
51 |
MS.Master; |
|
52 |
TGP.MarkDetailRowDeleted = function(row,del){ |
|
53 |
for(var i=0;i<row.DetailRow.length;i++) { |
|
54 |
if(row.DetailRow[i].Page) continue; |
|
55 |
row.DetailRow[i].Deleted = del; |
|
56 |
if(row.DetailGrid[i].ColorState&2) row.DetailGrid[i].ColorRow(row.DetailRow[i]); |
|
57 |
if(row.DetailRow[i].DetailRow) this.MarkDetailRowDeleted(row.DetailRow[i],del); |
|
58 |
} |
|
59 |
} |
|
60 |
ME.Master; |
|
61 |
// ----------------------------------------------------------------------------------------------------------- |
|
62 |
MS.Undo; |
|
63 |
TGP.DeleteRowUndo = function(row,del,refresh,upd){ |
|
64 |
if(typeof(row.Def)=="string") row.Def = this.Def[row.Def]; |
|
65 |
if(del!=="") row.Deleted = del; |
|
66 |
if(this.RowIndex && (this.ShowDeleted||row.Visible) && !(this.RowIndexType&1)) this.UpdateRowIndex(); |
|
67 |
if(refresh){ |
|
68 |
this.Recalculate(row,null,1); |
|
69 |
if(!this.ShowDeleted){ |
|
70 |
if(!row.Deleted) this.ShowRow(row,null,null,1); |
|
71 |
else this.HideRow(row,null,null,1); |
|
72 |
} |
|
73 |
if(this.ClearSelected&1) this.UpdatePanel(row); |
|
74 |
if(this.ColorState&2) this.ColorRow(row); |
|
75 |
if(del==="") this.UploadChanges(row); |
|
76 |
} |
|
77 |
|
|
78 |
MS.Gantt; if(!upd && this.GanttDependency && !this.ShowDeleted){ this.RefreshGantt(17); } ME.Gantt; |
|
79 |
MS.Master; if(row.DetailRow) for(var j=0;j<row.DetailRow.length;j++) if(!row.DetailRow[j].Page) row.DetailGrid[j].DeleteRowUndo(row.DetailRow[j],del,refresh,upd); ME.Master; |
|
80 |
} |
|
81 |
// ----------------------------------------------------------------------------------------------------------- |
|
82 |
TGP.DeleteRowRedo = function(row,del,refresh,upd,rem){ |
|
83 |
row.Deleted = del; |
|
84 |
if(this.RowIndex && this.ShowDeleted && !(this.RowIndexType&1)) this.UpdateRowIndex(); |
|
85 |
if(refresh){ |
|
86 |
this.Recalculate(row,null,1); |
|
87 |
if(!this.ShowDeleted){ |
|
88 |
if(!row.Deleted) this.ShowRow(row,null,null,1); |
|
89 |
else this.HideRow(row,null,null,1); |
|
90 |
} |
|
91 |
if(this.ClearSelected&1) this.UpdatePanel(row); |
|
92 |
if(this.ColorState&2) this.ColorRow(row); |
|
93 |
} |
|
94 |
|
|
95 |
MS.Gantt; if(!upd && this.GanttDependency && !this.ShowDeleted){ this.RefreshGantt(17); } ME.Gantt; |
|
96 |
if(row.DetailRow) for(var j=0;j<row.DetailRow.length;j++) if(!row.DetailRow[j].Page) row.DetailGrid[j].DeleteRowRedo(row.DetailRow[j],del,refresh,upd,rem); |
|
97 |
if(rem) this.DelRow(row); |
|
98 |
} |
|
99 |
ME.Undo; |
|
100 |
// ----------------------------------------------------------------------------------------------------------- |
|
101 |
// Deletes given row |
|
102 |
// type = 0 - no, 1 - confirm deletion, 2 - delete, 3 - undelete |
|
103 |
TGP.DeleteRow = function(row,type,test,remove){ |
|
104 |
if(!row || !this.Deleting || !Is(row,"CanDelete") || row.Kind=="Header" || this.Locked["delrow"]) return false; |
|
105 |
var del = row.Deleted-0; |
|
106 |
if(!type) type = del ? 3 : 1; |
|
107 |
if(type==3 && row.parentNode.Deleted-0) return false; |
c35f05
|
108 |
if(type==1 && (test || this.DeleteMessage==0||this.DeleteMessage==1 && this.ShowDeleted&&!remove && !this.AutoUpdate || !this.GetAlert("DelRow"))) type = 2; |
25ab64
|
109 |
if(Grids.OnCanRowDelete) { var tmp = Grids.OnCanRowDelete(this,row,type); if(tmp!=null) type = tmp; } |
c35f05
|
110 |
if(type==1) { var txt = this.GetAlert("DelRow"); type = test || !txt || this.Confirm(txt.replace("%d",this.GetName(row))) ? 2 : 0; } |
25ab64
|
111 |
if(type<=1) return false; |
F |
112 |
if((type==2 && del || type==3 && !del) && !remove) return false; |
|
113 |
if(test) return true; |
|
114 |
if(row==this.ERow && this.EditMode) this.EndEdit(); |
|
115 |
MS.Gantt; |
|
116 |
MS.GanttDependencies; |
|
117 |
if(this.GanttDependency) { |
|
118 |
var col = this.GetFirstGantt(); |
|
119 |
var P = type==2 ? this.SeparateTasks(row,col)[0] : null; |
|
120 |
this.GanttDelDep = this.Cols[col].GanttDeleteDependencies||this.AutoUpdate ? col : null; |
|
121 |
if(this.GanttDelDep && type==2 && row.firstChild) this.GanttStart(); |
|
122 |
} |
|
123 |
ME.GanttDependencies; |
|
124 |
ME.Gantt; |
|
125 |
this.UndoStart(); |
|
126 |
this.DeleteRowT(row,type,null,remove,1); |
|
127 |
if(this.RowIndex && this.ShowDeleted && (!(this.RowIndexType&1)||remove)) this.UpdateRowIndex(); |
|
128 |
//***删除时的行号处理 |
|
129 |
if(row["docitem"]!=undefined&&row["docitem"]>=this.docitem){ |
|
130 |
this.docitem-=10; |
|
131 |
this.docitemFlag=true; |
|
132 |
if (this.docitem==0 ) this.docitem=0; |
|
133 |
}else{//记录删除了多少次 |
|
134 |
this.docitemPer=row["docitem"]; |
|
135 |
this.docitemNum+=1; |
|
136 |
} |
|
137 |
this.UndoEnd(); |
|
138 |
MS.Gantt; |
|
139 |
MS.GanttDependencies; |
|
140 |
if(this.GanttDelDep && type==2 && row.firstChild) { this.GanttEnd(); this.RefreshGantt(249); this.CalculateSpaces(1); } |
|
141 |
if(this.GanttDependency) this.CorrectDependencies(row,this.GetFirstGantt(),null,P); |
|
142 |
ME.GanttDependencies; |
|
143 |
if(this.HasResources) this.RefreshGantt(129); |
|
144 |
ME.Gantt; |
|
145 |
MS.Animate; if(this.AnimRow(row,(type==2?"Delete":"Undelete")+(this.ShowDeleted&&!remove?"Visible":""),1,type==2&&!this.ShowDeleted||remove?this.ClearRow.bind(this,row,remove):null)) return true; ME.Animate; |
|
146 |
if(type==2&&!this.ShowDeleted||remove) this.ClearRow(row,remove); |
|
147 |
return true; |
|
148 |
} |
|
149 |
// ----------------------------------------------------------------------------------------------------------- |
|
150 |
TGP.ClearRow = function(row,del){ |
|
151 |
if(del) this.DelRow(row); |
|
152 |
else { |
|
153 |
if(row.Hasch) this.DeleteChildren(row); |
|
154 |
this.TableDelRow(row); |
|
155 |
} |
|
156 |
} |
|
157 |
// ----------------------------------------------------------------------------------------------------------- |
|
158 |
TGP.ClearRows = function(A,del){ |
|
159 |
for(var i=0;i<A.length;i++) this.ClearRow(A[i],del); |
|
160 |
} |
|
161 |
// ----------------------------------------------------------------------------------------------------------- |
|
162 |
// Deletes row |
|
163 |
// For noshow = true does not display changes => re-render is needed |
|
164 |
TGP.DeleteRowT = function(row, type, noshow, remove, noclear, noupload, master, notree){ |
|
165 |
if(this.ShowDeleted&&!remove){ |
|
166 |
|
|
167 |
this.MarkRowDeleted(row,type==2); |
|
168 |
|
|
169 |
} |
|
170 |
else { |
|
171 |
MS.Show; |
|
172 |
if(type==2){ |
|
173 |
if(!row.Page) this.HideFRow([row]); |
|
174 |
this.MarkRowDeleted(row,1,noshow,remove); |
|
175 |
if(row.Hasch&&!noclear) this.DeleteChildren(row); |
|
176 |
|
|
177 |
if(row.parentNode.Count) row.parentNode.Count--; |
|
178 |
if(row.Page && master){ |
|
179 |
for(var r=row.firstChild;r;r=r.nextSibling) this.HideRow(r,true,noshow,1); |
|
180 |
} |
|
181 |
else { |
|
182 |
this.HideRow(row,!noclear,noshow,1,this.Undo); |
|
183 |
MS.Undo; |
|
184 |
if(remove && this.Undo&6 && this.OUndo){ |
|
185 |
var OU = this.OUndo, p = OU.Pos-1; while(p>=0&&OU[p].Type=="End") p--; |
|
186 |
if(OU[p].Type!="Delete") for(var i=p-1;i>=0;i--) if(OU[i].Type=="Delete"){ OU.splice(p,0,OU.splice(i,1)[0]); break; } |
|
187 |
} |
|
188 |
ME.Undo; |
|
189 |
} |
|
190 |
|
|
191 |
MS.Group; |
|
192 |
if(row.Def.Group){ |
|
193 |
function hide(row){ |
|
194 |
for(var r=row.firstChild;r;r=r.nextSibling){ |
|
195 |
if(r.Def.Group) hide(r); |
|
196 |
else r.Visible=0; |
|
197 |
} |
|
198 |
} |
|
199 |
hide(row); |
|
200 |
} |
|
201 |
ME.Group; |
|
202 |
} |
|
203 |
else if(type==3){ |
|
204 |
this.MarkRowDeleted(row,0,noshow,remove); |
|
205 |
|
|
206 |
row.Deleted=0; |
|
207 |
if(row.Page && master && this.ShowDetail){; |
|
208 |
this.MasterGrid.ShowDetail(row.MasterRow,this.id); |
|
209 |
} |
|
210 |
else this.ShowRow(row,noshow,null,1); |
|
211 |
} |
|
212 |
if(!notree) this.CalcTreeWidth(); |
|
213 |
MX.Show; |
|
214 |
NoModule("Show"); |
|
215 |
ME.Show; |
|
216 |
} |
|
217 |
|
|
218 |
MS.Master; |
|
219 |
if(master!=1 && row.MasterRow){ |
|
220 |
this.MasterGrid.DeleteRowT(row.MasterRow,type,noshow,remove,noclear,1,row); |
|
221 |
} |
|
222 |
if(row.DetailRow){ |
|
223 |
for(var i=0;i<row.DetailRow.length;i++) if(row.DetailRow[i]!=master && !row.DetailRow[i].Page) row.DetailGrid[i].DeleteRowT(row.DetailRow[i],type,noshow,remove,noclear,1,1); |
|
224 |
} |
|
225 |
ME.Master; |
|
226 |
|
|
227 |
MS.Gantt; |
|
228 |
if(this.ResourcesGrid){ |
|
229 |
var G = this.ResourcesGrid, N = row[this.GanttResourcesName]; |
|
230 |
if(type==2) delete G.Resources[N]; |
|
231 |
else G.Resources[N] = { Name: N, Type: Get(row,this.GanttResourcesType), Price: Get(row,this.GanttResourcesPrice), Availability: Get(row,this.GanttResourcesAvailability) }; |
|
232 |
if(!noupload) G.Calculate(1); |
|
233 |
} |
|
234 |
if(this.Gantt) this.RefreshGanttPage(row,this.GetFirstGantt(),!noshow,1); |
|
235 |
ME.Gantt; |
|
236 |
|
|
237 |
if(!noshow) this.Recalculate(row,null,!noshow); |
|
238 |
|
|
239 |
MS.Chart; if(!noshow && this.Charts) this.UpdateCharts(row); ME.Chart; |
|
240 |
|
|
241 |
if(remove) { |
|
242 |
if(noclear) row.Removed = -1; |
|
243 |
else this.DelRow(row); |
|
244 |
} |
|
245 |
else if(!noshow && !noupload) { |
|
246 |
this.UploadChanges(row.firstChild?null:row); |
|
247 |
if(this.SaveValues) this.SaveCfg(); |
|
248 |
} |
|
249 |
if(!noshow){ |
|
250 |
this.HideMessage(); |
|
251 |
if(!this.ShowDeleted||remove){ |
|
252 |
|
|
253 |
MS.Paging; |
|
254 |
if(!this.GetFirstVisible() && this.Paging!=3) this.UpdatePager(); |
|
255 |
ME.Paging; |
|
256 |
this.Update(); |
|
257 |
} |
|
258 |
} |
|
259 |
} |
|
260 |
// ----------------------------------------------------------------------------------------------------------- |
|
261 |
// Changes value of ShowDeleted |
|
262 |
// Returns true if re-render is needed |
|
263 |
TGP.ChangeShowDeleted = function(){ |
|
264 |
MS.Show; |
|
265 |
var cnt = 0, noshow = false, C = this.Cols; |
|
266 |
this.ShowDeleted = !this.ShowDeleted; |
|
267 |
this.Rendering = true; |
|
268 |
for(var r=this.GetFirst();r;r=this.GetNext(r)) if(r.Deleted){ cnt++; if(cnt>30){ noshow = true; break; } } |
|
269 |
if(!noshow) for(var c in C) if(C[c].Deleted) { cnt += 10; if(cnt>30){ noshow = true; break; } } |
|
270 |
if(this.ShowDeleted){ |
|
271 |
for(var r=this.GetFirst(null,1);r;r=this.GetNext(r,1)) if(r.Deleted && !r.Filtered) this.ShowRow(r,noshow,null,1); |
|
272 |
|
|
273 |
for(var r=this.GetFirst();r;r=this.GetNext(r)) if(r.Deleted && !r.Filtered && !r.Visible) { |
|
274 |
|
|
275 |
if(!noshow){ |
|
276 |
var p = r.parentNode; |
|
277 |
if(p.r1 && !(p.State<4) && this.HasChildren(p)){ |
|
278 |
var n = this.GetNextVisible(p); |
|
279 |
if(n && n.parentNode==p && n.r1) { |
|
280 |
r.Visible = true; |
|
281 |
this.TableShowRow(r); |
|
282 |
this.UpdateRowIcons(r,true); |
|
283 |
} |
|
284 |
} |
|
285 |
if(p.r1){ r.Visible = true; this.UpdateIcon(p); } |
|
286 |
} |
|
287 |
r.Visible = true; |
|
288 |
} |
|
289 |
var F = this.GetFixedRows(); for(var r=0;r<r.length;r++) if(r.Deleted) this.ShowRow(r,null,null,1); |
|
290 |
if(noshow && this.Paging>0 && this.Paging<3) this.CreatePages(); |
|
291 |
if(noshow && this.MainCol) this.UpdateAllLevelImg(0,1); |
|
292 |
for(var c in C) if(C[c].Deleted) { if(noshow) C[c].Visible = 1; else this.ShowCol(c); } |
|
293 |
} |
|
294 |
else { |
|
295 |
for(var r=this.GetFirst();r;r=this.GetNext(r)) if(r.Deleted && !r.Filtered) this.HideRow(r,true,noshow,1); |
|
296 |
var F = this.GetFixedRows(); for(var r=0;r<r.length;r++) if(r.Deleted && !r.Filtered) this.HideRow(r,true,null,1); |
|
297 |
for(var c in C) if(C[c].Deleted) { if(noshow) C[c].Visible = 0; else this.HideCol(c); } |
|
298 |
} |
|
299 |
this.Rendering = false; |
|
300 |
if(noshow) return 1; |
|
301 |
|
|
302 |
MS.Gantt; if(this.GanttDependency){ this.RefreshGantt(17); } ME.Gantt; |
|
303 |
MS.Chart; if(this.Charts) this.UpdateCharts(); ME.Chart; |
|
304 |
this.UpdateHidden(); |
|
305 |
this.Update(); |
|
306 |
return 0; |
|
307 |
MX.Show; |
|
308 |
NoModule("Show"); |
|
309 |
ME.Show; |
|
310 |
} |
|
311 |
// ----------------------------------------------------------------------------------------------------------- |
|
312 |
TGP.ActionDeleteRow = function(F,T){ return this.DeleteRow(this.GetARow(F),1,T); } |
|
313 |
TGP.ActionUndeleteRow = function(F,T){ return this.DeleteRow(this.GetARow(F),3,T); } |
|
314 |
TGP.ActionRemoveRow = function(F,T){ return this.DeleteRow(this.GetARow(F),1,T,1); } |
|
315 |
// ----------------------------------------------------------------------------------------------------------- |
|
316 |
// ----------------------------------------------------------------------------------------------------------- |
|
317 |
// Deletes all selected rows |
|
318 |
TGP.ActionDeleteOrUndeleteRows = function(F,T,del,sel){ |
|
319 |
if(!this.Deleting || this.Locked["delrow"]) return false; |
|
320 |
var R = sel ? this.GetSelRows(0,"CanDelete") : this.GetARows(F), A = []; |
|
321 |
if(sel){ |
|
322 |
if(del==null){ |
|
323 |
var D = []; |
|
324 |
for(var i=0;i<R.length;i++) if(R[i].Deleted==1) D[D.length] = R[i]; else if(!R[i].Deleted) A[A.length] = R[i]; |
|
325 |
if(!D.length) del = 1; else { del = 0; A = D; } |
|
326 |
} |
|
327 |
else if(del==1) { for(var i=0;i<R.length;i++) if(!R[i].Deleted) A[A.length] = R[i]; } |
|
328 |
else if(!del) { for(var i=0;i<R.length;i++) if(R[i].Deleted==1) A[A.length] = R[i]; } |
|
329 |
else for(var i=0;i<R.length;i++) A[A.length] = R[i]; |
|
330 |
} |
|
331 |
else if(del==null){ |
|
332 |
var D = []; |
|
333 |
for(var id in R) if(R[id].Deleted==1) D[D.length] = R[id]; else if(!R[id].Deleted) A[A.length] = R[id]; |
|
334 |
if(!D.length) del = 1; else { del = 0; A = D; } |
|
335 |
} |
|
336 |
else if(del==1) { for(var id in R) if(!R[id].Deleted) A[A.length] = R[id]; } |
|
337 |
else if(!del) { for(var id in R) if(R[id].Deleted==1) A[A.length] = R[id]; } |
|
338 |
else for(var id in R) A[A.length] = R[id]; |
|
339 |
if(T||!A.length) return A.length; |
|
340 |
if(Grids.OnDeleteAll && Grids.OnDeleteAll(this,del)) return false; |
|
341 |
if(del){ |
|
342 |
var txt = this.GetAlert("DelSelected"); |
|
343 |
if(txt && (this.DeleteMessage==2||this.DeleteMessage==1 && (!this.ShowDeleted || del==2 || this.AutoUpdate)) && !this.Confirm(txt.replace("%d",A.length))) { Grids.Alert = 0; return false; } |
|
344 |
} |
|
345 |
if(this.RowCount<this.SynchroCount) { this.DeleteRows(A,del); return true; } |
|
346 |
this.ShowMessage(this.GetText("DelSelected")); |
|
347 |
T = this; setTimeout(function(){ T.DeleteRows(A,del); },10); |
|
348 |
return true; |
|
349 |
} |
|
350 |
// ----------------------------------------------------------------------------------------------------------- |
|
351 |
// Deletes selected rows, called from DeleteSelectedRows in timeout |
|
352 |
// del = 0 undelete, 1 delete, 2 remove |
|
353 |
TGP.DeleteRows = function(R,del){ |
|
354 |
var A = []; if(del==null) del = 1; |
|
355 |
for(var i=0;i<R.length;i++) { |
|
356 |
var d = del, can = R[i].CanDelete; if(can==null) can = R[i].Def.CanDelete; if(!can) continue; |
|
357 |
if(Grids.OnCanRowDelete) { var tmp = Grids.OnCanRowDelete(this,R[i],del?2:3,R); if(tmp!=null) d = tmp==2?(del==2?1:2):(tmp==3?0:-1); } |
|
358 |
if(d!=-1&&(d==2||(d?!R[i].Deleted:R[i].Deleted==1))) A[A.length] = R[i]; |
|
359 |
} |
|
360 |
var len = A.length; if(!len) return 0; |
|
361 |
MS.Gantt; |
|
362 |
MS.GanttDependencies; |
|
363 |
if(this.GanttDependency) { |
|
364 |
var col = this.GetFirstGantt(), P = []; |
|
365 |
if(del) P = this.SeparateTasks(null,col,null,A); |
|
366 |
this.GanttDelDep = this.Cols[col].GanttDeleteDependencies||this.AutoUpdate ? col : null; |
|
367 |
if(this.GanttDelDep && del) this.GanttStart(); |
|
368 |
} |
|
369 |
ME.GanttDependencies; |
|
370 |
ME.Gantt; |
|
371 |
if(len>1) { |
|
372 |
if(len<this.SynchroCount) this.StartUpdate(); |
|
373 |
else this.UndoStart(); |
|
374 |
MS.Pivot; |
|
375 |
if(this.PivotDetail) for(var id in this.PivotDetail){ var G = this.PivotDetail[id]; if(G && !G.Loading && !G.Cleared && !G.Rendering && G.PivotUpdate>=2) G.StartUpdate(); } |
|
376 |
if(this.PivotGrid && this.PivotUpdate>=1) { this.StartUpdate(); this.PivotGrid.StartUpdate(); } |
|
377 |
ME.Pivot; |
|
378 |
} |
|
379 |
else this.UndoStart(); |
|
380 |
for(var i=0;i<len;i++) this.DeleteRowT(A[i],del?2:3,A[i].Fixed?false:len>=this.SynchroCount,del==2,1,len>1,null,1); |
|
381 |
if(this.RowIndex && this.ShowDeleted && !(this.RowIndexType&1)) this.UpdateRowIndex(); |
|
382 |
if(len>1){ |
|
383 |
MS.Pivot; |
|
384 |
if(this.PivotDetail) for(var id in this.PivotDetail){ var G = this.PivotDetail[id]; if(G && !G.Loading && !G.Cleared && !G.Rendering && G.PivotUpdate>=2) G.EndUpdate(); } |
|
385 |
if(this.PivotGrid && this.PivotUpdate>=1) { this.EndUpdate(); this.PivotGrid.EndUpdate(); } |
|
386 |
ME.Pivot; |
|
387 |
if(len<this.SynchroCount) this.EndUpdate(); |
|
388 |
else { |
|
389 |
this.UndoEnd(); |
|
390 |
if(this.AutoUpdate) this.UploadChanges(); |
|
391 |
} |
|
392 |
} |
|
393 |
else this.UndoEnd(); |
|
394 |
this.CalcTreeWidth(); |
|
395 |
MS.Gantt; |
|
396 |
MS.GanttDependencies; |
|
397 |
if(this.GanttDelDep && del) { this.GanttEnd(); this.RefreshGantt(249); } |
|
398 |
if(this.GanttDependency) { |
|
399 |
if(!del) P = this.SeparateTasks(null,col,null,A); |
|
400 |
for(var i=0;i<P.length;i++) this.CorrectDependencies(null,col,null,P[i]); |
|
401 |
} |
|
402 |
ME.GanttDependencies; |
|
403 |
MS.GanttResources; |
|
404 |
if(this.HasResources) this.RefreshGantt(129); |
|
405 |
if(len>1 && this.ResourcesGrid) this.ResourcesGrid.Calculate(1); |
|
406 |
ME.GanttResources; |
|
407 |
ME.Gantt; |
|
408 |
if(this.SaveValues) this.SaveCfg(); |
|
409 |
if(len>this.SynchroCount){ this.Calculate(2,1); this.RenderBody(); } |
|
410 |
else { |
|
411 |
this.HideMessage(); |
|
412 |
MS.Animate; if(this.AnimRows(A,(del?"Delete":"Undelete")+(this.ShowDeleted&&del!=2?"VisibleRows":"Rows"),1,del&&!this.ShowDeleted||del==2?this.ClearRows.bind(this,A,del==2):null)) return true; ME.Animate; |
|
413 |
if(del&&!this.ShowDeleted||del==2) this.ClearRows(A,del==2); |
|
414 |
} |
|
415 |
return len; |
|
416 |
} |
|
417 |
// ----------------------------------------------------------------------------------------------------------- |
|
418 |
TGP.ActionDeleteRows = function(F,T){ return this.ActionDeleteOrUndeleteRows(F,T,1); } |
|
419 |
TGP.ActionUndeleteRows = function(F,T){ return this.ActionDeleteOrUndeleteRows(F,T,0); } |
|
420 |
TGP.ActionRemoveRows = function(F,T){ return this.ActionDeleteOrUndeleteRows(F,T,2);} |
|
421 |
TGP.ActionDeleteSelected = function(F,T){ return F||this.EventObject.Type!=1||this.ARow&&(this.ARow.Selected||this.ARow.Kind!="Data") ? this.ActionDeleteOrUndeleteRows(0,T,1,1) : 0; } |
|
422 |
TGP.ActionUndeleteSelected = function(F,T){ return F||this.EventObject.Type!=1||this.ARow&&(this.ARow.Selected||this.ARow.Kind!="Data") ? this.ActionDeleteOrUndeleteRows(0,T,0,1) : 0; } |
|
423 |
TGP.ActionRemoveSelected = function(F,T){ return F||this.EventObject.Type!=1||this.ARow&&(this.ARow.Selected||this.ARow.Kind!="Data") ? this.ActionDeleteOrUndeleteRows(0,T,2,1) : 0; } |
|
424 |
|
|
425 |
// ----------------------------------------------------------------------------------------------------------- |
|
426 |
MS.Select; |
|
427 |
// ----------------------------------------------------------------------------------------------------------- |
|
428 |
// Deletes all selected rows |
|
429 |
|
|
430 |
// ----------------------------------------------------------------------------------------------------------- |
|
431 |
ME.Select; |
|
432 |
// ----------------------------------------------------------------------------------------------------------- |
|
433 |
// ----------------------------------------------------------------------------------------------------------- |
|
434 |
ME.Delete; |