Commit 6f40dab8 authored by dkasliwal's avatar dkasliwal

bug solve for date sorting in grid dash board. add trim() to getValidDate...

bug solve for date sorting in grid dash board. add trim() to getValidDate method passing string value.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99456 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c5c9a2db
...@@ -244,7 +244,6 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel> ...@@ -244,7 +244,6 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
E12CustomTextCell.incrFactor = 0; E12CustomTextCell.incrFactor = 0;
E12CustomTextCell.editableField = null; E12CustomTextCell.editableField = null;
E12CustomTextCell.prvEditableField = null; E12CustomTextCell.prvEditableField = null;
// handler for table sorting // handler for table sorting
final ListHandler<DataGridTableRowModel> sortHandler = new ListHandler<DataGridTableRowModel>( dataProvider.getList()) final ListHandler<DataGridTableRowModel> sortHandler = new ListHandler<DataGridTableRowModel>( dataProvider.getList())
{ {
...@@ -280,25 +279,29 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel> ...@@ -280,25 +279,29 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
{ {
firstColumn = column; firstColumn = column;
}*/ }*/
sortHandler.setComparator( column , new Comparator<DataGridTableRowModel>() sortHandler.setComparator( column , new Comparator<DataGridTableRowModel>()
{ {
public int compare( DataGridTableRowModel o1, DataGridTableRowModel o2 ) public int compare( DataGridTableRowModel o1, DataGridTableRowModel o2 )
{ {
if(isValidDate1(o1.getCellText( index )) && isValidDate1(o2.getCellText( index ))) /*pass value to isValidDate1 with trim() By Dhanendra On Date 17-12-2015*/
if(isValidDate1(o1.getCellText( index ).trim()) && isValidDate1(o2.getCellText( index ).trim()))
{ {
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy"); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
Date date1=null,date2=null; Date date1=null,date2=null;
try try
{ {
date1 = formatter.parse(o1.getCellText( index )); date1 = formatter.parse(o1.getCellText( index ).trim());
date2 = formatter.parse(o2.getCellText( index )); date2 = formatter.parse(o2.getCellText( index ).trim());
} catch (Exception e) } catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
return date1.compareTo(date2); return date1.compareTo(date2);
} }
if(isValidDouble(o1.getCellText( index )) && isValidDouble(o2.getCellText( index ))) else if(isValidDouble(o1.getCellText( index )) && isValidDouble(o2.getCellText( index )))
{ {
return Double.compare(Double.parseDouble(o1.getCellText( index )), Double.parseDouble(o2.getCellText( index ))); return Double.compare(Double.parseDouble(o1.getCellText( index )), Double.parseDouble(o2.getCellText( index )));
} }
...@@ -680,13 +683,14 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel> ...@@ -680,13 +683,14 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
public int compare( DataGridTableRowModel o1, DataGridTableRowModel o2 ) public int compare( DataGridTableRowModel o1, DataGridTableRowModel o2 )
{ {
if(isValidDate1(o1.getCellText( index )) && isValidDate1(o2.getCellText( index ))) /*pass value to isValidDate1 with trim() By Dhanendra On Date 17-12-2015*/
if(isValidDate1(o1.getCellText( index ).trim()) && isValidDate1(o2.getCellText( index ).trim()))
{ {
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy"); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yy");
Date date1=null,date2=null; Date date1=null,date2=null;
try { try {
date1 = formatter.parse(o1.getCellText( index )); date1 = formatter.parse(o1.getCellText( index ).trim());
date2 = formatter.parse(o2.getCellText( index )); date2 = formatter.parse(o2.getCellText( index ).trim());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -875,7 +879,8 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel> ...@@ -875,7 +879,8 @@ public class CustomGrid extends AbstractDataGrid<DataGridTableRowModel>
{ {
Date date = formatter.parse(dateString); Date date = formatter.parse(dateString);
} }
catch(Exception ParseException){ catch(Exception ParseException)
{
return false; return false;
} }
return true; return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment