1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.uif.helper; |
17 | |
|
18 | |
import java.util.Date; |
19 | |
|
20 | |
import org.apache.commons.lang.ClassUtils; |
21 | |
import org.kuali.rice.kns.uif.UifConstants; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | 0 | public class TableToolsHelper { |
28 | |
|
29 | |
public static String constructTableColumnOptions(boolean isSortable, Class dataTypeClass){ |
30 | |
|
31 | 0 | String colOptions = "null"; |
32 | |
|
33 | 0 | if (!isSortable || dataTypeClass == null){ |
34 | 0 | colOptions = "{ \"" + UifConstants.TableToolsKeys.SORTABLE + "\" : false } "; |
35 | |
}else{ |
36 | 0 | if (ClassUtils.isAssignable(dataTypeClass, String.class)){ |
37 | 0 | colOptions = "{ \"" + UifConstants.TableToolsKeys.SORT_DATA_TYPE + "\" : \"" + UifConstants.TableToolsValues.DOM_TEXT + "\" } "; |
38 | 0 | }else if (ClassUtils.isAssignable(dataTypeClass, Date.class)){ |
39 | 0 | colOptions = "{ \"" + UifConstants.TableToolsKeys.SORT_DATA_TYPE + "\" : \"" + UifConstants.TableToolsValues.DOM_TEXT + "\" , \"" + UifConstants.TableToolsKeys.SORT_TYPE + "\" : \"" + UifConstants.TableToolsValues.DATE + "\" } "; |
40 | 0 | }else if (ClassUtils.isAssignable(dataTypeClass, Number.class)){ |
41 | 0 | colOptions = "{ \"" + UifConstants.TableToolsKeys.SORT_DATA_TYPE + "\" : \"" + UifConstants.TableToolsValues.DOM_TEXT + "\" , \"" + UifConstants.TableToolsKeys.SORT_TYPE + "\" : \"" + UifConstants.TableToolsValues.NUMERIC + "\" } "; |
42 | |
} |
43 | |
} |
44 | |
|
45 | 0 | return colOptions; |
46 | |
} |
47 | |
} |