검색결과 리스트
IT/Component에 해당되는 글 5건
- 2010/12/08 [Farpoint Spread] Excel 저장시 버그?
- 2009/01/23 [DevExpress] DisableThreadingProblemsDetection 문제
- 2009/01/06 [Devexpress] Xtragrid 에서 선택된 행 유지
- 2008/09/02 [DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index
- 2008/08/29 [DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기
글
[Farpoint Spread] Excel 저장시 버그?
하단에 요약행을 추가해서 수식(Formula)을 활용 Summary 데이터를 보여주게 작성을해서 사용해왔는데..
spread 의 Excel 저장함수인 ExcelSpread.SaveExcel(_filePath, FarPoint.Win.Spread.Model.IncludeHeaders.ColumnHeadersCustomOnly); 로 저장을 하면
Formula Cell 의 Value 가 이상하게 첫번째 컬럼부터 변경되어 저장이 되버림 : SUM(D4:D100) => SUM(A1:D100)
헐... 이래저래 해봤으나 컴퍼넌트 버그라고 자체 결론 ㅡㅡ;;
걍 수식이 아니라 데이터 형태로 저장하게 변경함
// 2010-12-08 NOTE By 박재용 : Formula 가 잘못 저장되는 버그가 있어서 Formula 를 수식이 아니라 그냥 Data 로 저장
ExcelSpread.SaveExcel(_filePath, ExcelSaveFlags.NoFormulas | ExcelSaveFlags.SaveCustomColumnHeaders);
'IT > Component' 카테고리의 다른 글
| [Farpoint Spread] Excel 저장시 버그? (0) | 2010/12/08 |
|---|---|
| [DevExpress] DisableThreadingProblemsDetection 문제 (0) | 2009/01/23 |
| [Devexpress] Xtragrid 에서 선택된 행 유지 (0) | 2009/01/06 |
| [DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index (0) | 2008/09/02 |
| [DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기 (0) | 2008/08/29 |
글
[DevExpress] DisableThreadingProblemsDetection 문제
DevExpress 를 8.1.6 을 쓰다가 전체적으로 8.3.3 으로 업그레이드 했다...
리빌드 할땐 문제없다... but... 런타임에 위와 같은 에러가 생긴다... 머지??
처음엔 내가 Catch 안한 오류가 있나 해서 소스를 다시 한번 살펴봤다... 근데.. 소스는 바뀐게 없는데...
이상하다 그래서 자세히 살펴보니 Cross Thread... 얼레.. 분명히 왜만한건 InvokeRequired 체크해서 다 되어있는데.... 물론 이 부분도 소스를 수정하지 않았기 때문에 이전에 없던 문제인데... 말이 안된다...
그렇다고 지금 당장 gridcontrol 함수에 일일이 Invoke 형태로 변경하기도 그렇고....
그래서 DevExpress 사이트에서 해결 방법을 찾아보기로 했다
How to avoid the ArgumentOutOfRangeException exception when updating the Grid's data source within a background thread
|
|
Description
I have a data table connected to a GridControl that I'm modifying within different threads, and the Xtragrid component seems to be catching the updates automatically and trying to refresh based on the data changes. However, sometimes the application crashes with an ArgumentOutOfRangeException. How to avoid this problem?
Solution
This issue is not connected with the XtraGrid directly. Unfortunately, you can't change the grid's data source in a background thread since it will cause a lot of problems with synchronization. The XtraGrid may perform some operations with the underlying data source at the same time as your background thread changes it. In this case the grid may receive a Change notification later and will try to update rows from the data source which will cause the mentioned problem. This problem may occur in a lot of cases. For example, when a user edits data, groups it or the XtraGrid tries to recalculate the summaries. The only solution to this problem is to change the Grid's DataSource reference within a background thread (NOTE: You will need to implement it using the Invoke method). Said differently, within a background thread you should work with a local copy of the DataSource and pass its clone to the Grid's DataSource when necessary. In the attachment you will find a sample project which demonstrates this approach.
요약하자면... XtraGrid 와 바인딩해서 사용하는 경우.. background thread 로 처리를 해라???
거기다 샘플까지 있으니... 불려다가... 그냥 다시 다른걸루 찾아보니..
DevExpress.Data.CurrencyDataController.DisableThreadingProblemsDetection = true
저 프로퍼티가 obsolete 라고 하지만 현재는... 사용하면 된다고 하네... 다행이다.. 가장 간단하군...
그래서 두번째 껄로 적용. 실제 해보니 가장 간단하면서도 잘 돌아간다... 임시방편일까?
obsolete 라서 좀 그렇긴 하지만.. 일단 이렇게 하니 관련 에러가 모두 사라졌다.
XtraGrid 는 내부적으로 Grid 와 DataSource 와의 동기와 처리를 한다고 되어있는데 그래서 인지 위 프로퍼티를 적용하기 전까지는 DevExpress.Data 에서 에러가 발생하고... 막 이카고....
스타일이 웬만하면 Catch 를 넣어주는걸 선호하는 지라...
아 참!! 이 함수를 DevExpress 에서는 Main 넣는 샘플로 설명이 되어있는데...
Grid 를 쓰는 부분이 공용 컴퍼넌트라서 처음에서 Main 넣어서 사용하다가 혹시나 해서 걍 해당 컴퍼넌트 생성자에 넣어서 사용해 보니.. 잘 돌아간다...
일일이 저 컴퍼넌트 쓰는 App Main 일일이 넣기 귀찮으니... 컴퍼넌트 자체에 박아놓고 쓰지머..
'IT > Component' 카테고리의 다른 글
| [Farpoint Spread] Excel 저장시 버그? (0) | 2010/12/08 |
|---|---|
| [DevExpress] DisableThreadingProblemsDetection 문제 (0) | 2009/01/23 |
| [Devexpress] Xtragrid 에서 선택된 행 유지 (0) | 2009/01/06 |
| [DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index (0) | 2008/09/02 |
| [DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기 (0) | 2008/08/29 |
글
[Devexpress] Xtragrid 에서 선택된 행 유지
정렬 이벤트에서 미리 View 와 Rowhandle 을 잡아두고 정렬이 끝나면 이전 잡아둔 행으로 이동
새로고침 될때 사용하면 되겠네...
using DevExpress.XtraGrid.Views.Grid;
...
object SaveFocusedRow = null;
private void gridView_StartSorting(object sender, System.EventArgs e) {
GridView view = sender as GridView;
SaveFocusedRow = view.GetRow(view.FocusedRowHandle);
}
private void gridView_EndSorting(object sender, System.EventArgs e) {
GridView view = sender as GridView;
int rowHandle = FindRowHandleByRowObject(view, SaveFocusedRow);
if(rowHandle != GridControl.InvalidRowHandle) {
view.FocusedRowHandle = rowHandle;
SaveFocusedRow = null;
}
}
private int FindRowHandleByRowObject(DevExpress.XtraGrid.Views.Grid.GridView view, object row) {
if(row != null)
for(int i = 0; i < view.DataRowCount; i++)
if(row.Equals(view.GetRow(i)))
return i;
return DevExpress.XtraGrid.GridControl.InvalidRowHandle;
}
private int FindRowHandleByDataRow(DevExpress.XtraGrid.Views.Grid.GridView view, DataRow row) {
if(row != null)
for(int i = 0; i < view.DataRowCount; i++)
if(view.GetDataRow(i) == row)
return i;
return DevExpress.XtraGrid.GridControl.InvalidRowHandle;
}
'IT > Component' 카테고리의 다른 글
| [Farpoint Spread] Excel 저장시 버그? (0) | 2010/12/08 |
|---|---|
| [DevExpress] DisableThreadingProblemsDetection 문제 (0) | 2009/01/23 |
| [Devexpress] Xtragrid 에서 선택된 행 유지 (0) | 2009/01/06 |
| [DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index (0) | 2008/09/02 |
| [DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기 (0) | 2008/08/29 |
글
[DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index
- gridView2.GetSelectedRows()
실제 Grid 의 선택된 Row 의 실제 데이터소스의 Index 받아오기
- gridView2.GetDataSourceRowIndex(gridView2.GetSelectedRows()[0])
그리고.. 추가로 위의 소스로 데이터를 한개의 Row 씩 순차적으로 삭제할때(Grid, DataSource 모두)해당 Row 를 삭제한후 다시 RowHandle 및 DataSourceRowIndex 를 받아와야함
즉, 삭제되기 전의 Handle 또는 RowIndex 가 삭제된 후에는 변경이 되더라... 쩝 -+-;;
'IT > Component' 카테고리의 다른 글
| [Farpoint Spread] Excel 저장시 버그? (0) | 2010/12/08 |
|---|---|
| [DevExpress] DisableThreadingProblemsDetection 문제 (0) | 2009/01/23 |
| [Devexpress] Xtragrid 에서 선택된 행 유지 (0) | 2009/01/06 |
| [DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index (0) | 2008/09/02 |
| [DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기 (0) | 2008/08/29 |
글
[DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기
IList<int> _list = new List<int>();
try {
int[] _arrHandles = gridView2.GetSelectedRows();
foreach(int _handle in _arrHandles) {
if(!gridView2.IsGroupRow(_handle)) {
_list.Add(gridView2.GetDataSourceRowIndex(_handle));
}
}
} catch(Exception ex) {
MyLogger.SendLog(EnNlogLevel.ERROR, ex.ToString(), "GetSelectRowhandleCountWithoutGroup");
return new List<int>();
}
return _list;
}
GridView 의 isGroupRow 함수 사용이 관건
'IT > Component' 카테고리의 다른 글
| [Farpoint Spread] Excel 저장시 버그? (0) | 2010/12/08 |
|---|---|
| [DevExpress] DisableThreadingProblemsDetection 문제 (0) | 2009/01/23 |
| [Devexpress] Xtragrid 에서 선택된 행 유지 (0) | 2009/01/06 |
| [DevExpress] Grid 의 특정 Row Handle 과 Grid DataSource 의 Index (0) | 2008/09/02 |
| [DevExpress] Grid 에서 그룹Row 를 제외한 Row Handle List 받아오기 (0) | 2008/08/29 |
