"Old" table sorter for NW04

Hi all,
I'm using the "old" table sorter for Web Dynpro on a Netweaver 04 system. Everything is working correctly, but I don't know how to call the sort function without clicking on the Table Header.
How can I automatically sort my table at runtime, the first time the table is shown?
Is this possible?

Hi  Palen
I do think this facility is introduced with 04s.
/people/bertram.ganz/blog/2006/03/07/enhanced-web-dynpro-java-tablesorter-for-sap-netweaver-04s
This weblog says something about it.(Hope you have not read it ye
Regards
Pratyush

Similar Messages

  • Table Sorter for String displaying Numbers

    Hi All.
    I have a table whose one of the columns display numbers with data type string. This is becuase :
    1. RFC gives me as String.
    2. I have to display blank in case no value or zero is present (since int, long etc default to Zero, hence  
        not used).
    I have to sort this column as a number.Since the datatype is string, it sorts the numbers as string
    for example : if we have  values like : 2, 4, 3, 10, 19, 15, 20, 22
    currently as String it sorts as follows : 10, 15, 19, 2, 20, 22, 3, 4.
    but i want as follows : 2, 3, 4, 10, 15, 19, 20, 22.
    Useful answers will appreciated.
    Thanks and regards,
    Aditya Deshpande.

    In order to sort the node with attribute of type string; please use the following code..
    Here use the node where you store the string value..
    wdContext.nodeTest().sortElements(
                new Comparator() {
                   public int compare(Object o1, Object o2) {
                        // TODO Auto-generated method stub
                   IPrivateExperimentView.ITestElement ele1 = (IPrivateExperimentView.ITestElement)o1;
                   IPrivateExperimentView.ITestElement ele2 = (IPrivateExperimentView.ITestElement)o2;
                        return Integer.parseInt( ele1.getNumStr()) > Integer.parseInt( ele2.getNumStr()) ? 1 : -1;
    input :  "2", "4", "3", "10", "19", "15", "20", "22"
    result : "2", "3", "4", "10", "15", "19", "20", "22"
    vinod

  • Input table sort for uncommited data

    Hi OTN,
    I have an input table on my ADF page. The table is based on a view object which has ORDER BY VALUE clause.
    There is an opportunity to insert new rows and edit Value attribute of any row.
    I would like the table always to be sorted by Value attribute before commiting the changes.
    Input fields have autosubmit=true and I also have button which performs ADFUtils.findIterator(..).executeQuery() and refreshing the table (with addPartialTarget or table's partial trigger).
    Besides I tried declarative column sorting.
    By no means I succeeded to sort the table with new values without commiting data.
    Is there any possibility to do this?
    Thanks.
    JDev 11.1.1.4

    Hi,
    After applying this code in a managed bean           System.out.println("ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS");
              trIter.getViewObject().setQueryMode(ViewObject.QUERY_MODE_SCAN_DATABASE_TABLES | ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
              trIter.getViewObject().setSortBy("NEnd");
              trIter.executeQuery();in-memory sorting really works.
    But now I have a row with null NEnd first in my table. Without modifying query mode it was last just as I need.
    It is now:null
    10
    20
    30Can I bring null row back to last position?
    Tried trIter.getViewObject().setSortBy("NEnd nulls last"); and trIter.getViewObject().setSortBy("deocde(NEnd, null, 9999, NEnd)"); with no success.
    Edited by: ILya Cyclone on Jul 8, 2011 3:28 PM

  • ADF table sorting for non-english language

    Hi,
    I have an issue with sorting in af:table. When I click on column header data are sorted, but not quite correctly. If word begins with polish character e.g. Ł,Ś,Ć, etc.., this row is located at the end, after 'Z'.
    How can I implement correct sorting?
    Edited by: Kamil Jackiewicz on 2012-03-24 12:37

    --todelete                                                                                                                                                                                                                                                       

  • Table sorter

    Hi,
         i have to implement a table sorter in one of my webdypro application. I have done all the steps mentioned in one of the blog and have also imported TableSorter.java class. i am getting sorting icons in column headers. but on clicking icon nothing happens...i think there is some problem with the java class which i have imported. So can anybody provide the code of tablesorter.java class.
    Thanks in advance,
        Reena

    Hi Reena,
    Here is the code.Just change the package name.
    * Created on Sep 6, 2007
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    package ibm.com.tradefund.utils;
    * @author Administrator
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    import java.text.Collator;
    import java.util.ArrayList;
    import java.util.Collection;
    import java.util.Comparator;
    import java.util.HashMap;
    import java.util.Iterator;
    import java.util.Map;
    import java.util.StringTokenizer;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByIndex;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByKey;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractInputField;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractTableColumn;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCaption;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDCheckBox;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDLink;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDProgressIndicator;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDRadioButton;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableCellEditor;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumn;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTableColumnGroup;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextEdit;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTextView;
    import com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTableColumnSortDirection;
    import com.sap.tc.webdynpro.progmodel.api.IWDAction;
    import com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent;
    import com.sap.tc.webdynpro.progmodel.api.IWDNode;
    import com.sap.tc.webdynpro.progmodel.api.IWDNodeElement;
    import com.sap.tc.webdynpro.progmodel.api.IWDViewElement;
    import com.sap.tc.webdynpro.services.sal.localization.api.WDResourceHandler;
    * Helper class that makes a Web Dynpro table UI element sortable (column-wise).
    public final class TableSorter {
          * @param table
          * @param sortAction
          * @param comparators
          * Creates a table sorter for the given table using the given sort action.
          * This constructor must be called from <code>wdDoModifyView()</code>, but
          * usually only when that hook is called for the first time. Store the newly
          * created instance in a context attribute with Java native type
          * <code>com.sap.tc.webdynpro.tests.utils.TableSorter</code>.
          * The given sort action's event handler will be bound to the <code>onSort</code>
          * event of the table and must at least call this table sorter's
          * <code>sort(wdEvent)</code> method.
          * Every column of the table is made sortable if possible according to the
          * following rules.
          * If a comparator is given for a column's ID and it is a
          * <code>NodeElementByAttributeComparator</code>, then that comparator defines
          * both the attribute and the ordering used to sort that column.
          * If any other comparator is given and an attribute can be determined from
          * that column's table cell editor, then that attribute is used to sort that
          * column according to the ordering imposed by the given comparator.
          * If no comparator is given but an attribute can be determined from
          * that column's table cell editor, then that attribute is used to sort that
          * column according to the natural ordering of that attribute's type.
          * Else that column is left untouched.
          * Additionally it is possible to define the sortable columns by their
          * TableColumn UI element ids.
          * @see sort()
          * @see NodeElementByAttributeComparator
          * @see com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDTable
         public TableSorter(IWDTable table, IWDAction sortAction, Map comparators) {
              init(table, sortAction, comparators, null);
         public TableSorter(IWDTable table, IWDAction sortAction, Map comparators, String[] sortableColumns) {
              init(table, sortAction, comparators, sortableColumns);
          * Initialisation stuff
         private void init(IWDTable table, IWDAction sortAction, Map comparators, String[] sortableColumns){
              this.table = table;
              if(sortableColumns == null){
                   sortableCols = null;
              }else{
                   sortableCols = new HashMap();
                   for (int i = 0; i < sortableColumns.length; i++) {
                        sortableCols.put(sortableColumns<i>, sortableColumns<i>);
              // sanity checks
              if (sortAction == null)
                   throw new IllegalArgumentException("Sort action must be given");
              if (table == null)
                   throw new IllegalArgumentException("Table must be given");
              if (table.bindingOfDataSource() == null)
                   throw new IllegalArgumentException(
                        "Data source of table with id '" + table.getId() + "' must be bound");
              // make the columns sortable
              String dataSourcePrefix = table.bindingOfDataSource() + ".";
              //TODO: remove the following line since this method is not longer available in later releases
              setComparatorsForColumns(dataSourcePrefix, table.iterateColumns(), comparators);
              setComparatorsForColumns(dataSourcePrefix, table.iterateGroupedColumns(), comparators);
              //set up the table properties
              table.setOnSort(sortAction);
              table.mappingOfOnSort().addSourceMapping(IWDTable.IWDOnSort.COL, "selectedColumn");
              table.mappingOfOnSort().addSourceMapping(IWDTable.IWDOnSort.DIRECTION, "sortDirection");     
          * Try to make the given columns sortable (recusivly, if necessary)
         private void setComparatorsForColumns(String dataSourcePrefix, Iterator columnIterator, Map comparators){
              int index = 0;
              for (Iterator it = columnIterator; it.hasNext(); ++index) { // for every column: try to make it bindable
                   IWDAbstractTableColumn abstractColumn = (IWDAbstractTableColumn) it.next();
                   if(abstractColumn instanceof IWDTableColumn){
                        IWDTableColumn column = (IWDTableColumn)abstractColumn;
                        if(sortableCols == null || sortableCols.containsKey(column.getId())){
                             //try to make this column sortable
                             Comparator comparator = null;
                             if (comparators != null){
                                  comparator = (Comparator)comparators.get(column.getId());
                             NodeElementByAttributeComparator elementComparator = null;     
                             if (comparator instanceof NodeElementByAttributeComparator) {
                                  // the easy one, attribute and ordering are given
                                  elementComparator = (NodeElementByAttributeComparator)comparator;
                             } else { // attribute must be determined
                                  String bindingOfPrimaryProperty = bindingOfPrimaryProperty(column.getTableCellEditor());
                                  if (bindingOfPrimaryProperty == null || !bindingOfPrimaryProperty.startsWith(dataSourcePrefix)){
                                       //no attribute found or outside of data source
                                       column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
                                       continue;
                                  String attributeName = bindingOfPrimaryProperty.substring(dataSourcePrefix.length());
                                  Collection subnodes = new ArrayList();
                                  if (attributeName.indexOf('.') >= 0){
                                       //attribute not immediately below data source
                                       String[] tokens = tokenize (attributeName, ".");
                                       for(int i=0; i<tokens.length-1; i++){
                                            subnodes.add(tokens<i>);
                                       attributeName = tokens[tokens.length-1];
                                  if(subnodes.size() == 0){
                                       elementComparator = new NodeElementByAttributeComparator(attributeName, comparator);
                                  }else{
                                       elementComparator = new NodeElementByAttributeComparator(attributeName, comparator, subnodes);
                             // set up internal data structures
                             comparatorForColumn.put(column, elementComparator);
                             //set sort state
                             column.setSortState(WDTableColumnSortDirection.NONE);
                        }else{
                             //column should not be sortable
                             column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
                   }else if (abstractColumn instanceof IWDTableColumnGroup){
                        //it's just a column group -> try to bind the columns of the column group
                        IWDTableColumnGroup columnGroup = (IWDTableColumnGroup)abstractColumn;
                        setComparatorsForColumns(dataSourcePrefix, columnGroup.iterateColumns(), comparators);
          * Tokenizes the input string according to the given delimiters. The delimiters will be left out.
          * Example: tokenize("Hello_World", "_") results ["Hello", "World"]
         private String[] tokenize (String input, String delim){
              StringTokenizer tokenizer = new StringTokenizer(input, delim);
              String[] tokens = new String[tokenizer.countTokens()];
              int index = 0;
              while(tokenizer.hasMoreTokens()){
                   tokens[index] = tokenizer.nextToken();
                   index++;
              return tokens;
          * This method must be called from the event handler of this table sorter's
          * sort action. It performs the actual sort operation.
         public void sort(IWDCustomEvent wdEvent, IWDNode dataSource) {
              // find the things we need
              String columnId = wdEvent.getString("selectedColumn");
              String direction = wdEvent.getString("sortDirection");
              IWDTableColumn column = (IWDTableColumn) table.getView().getElement(columnId);
              NodeElementByAttributeComparator elementComparator = (NodeElementByAttributeComparator) comparatorForColumn.get(column);
              if (elementComparator == null){
                   //not a sortable column
                   column.setSortState(WDTableColumnSortDirection.NOT_SORTABLE);
                   return;
              // sorting
              elementComparator.setSortDirection(WDTableColumnSortDirection.valueOf(direction));
              dataSource.sortElements(elementComparator);
          * Returns the binding of the given table cell editor's property that is
          * considered "primary" or <code>null</code> if no such binding exists or no
          * such property can be determined.
         private static final String bindingOfPrimaryProperty(IWDTableCellEditor editor) {
              return editor instanceof IWDViewElement ? bindingOfPrimaryProperty((IWDViewElement) editor) : null;
          * Returns the binding of the given view element's property that is
          * considered "primary" or <code>null</code> if no such binding exists or no
          * such property can be determined.
         private static final String bindingOfPrimaryProperty(IWDViewElement element) {
              if (element instanceof IWDAbstractDropDownByIndex)
                   return ((IWDAbstractDropDownByIndex) element).bindingOfTexts();
              if (element instanceof IWDAbstractDropDownByKey)
                   return ((IWDAbstractDropDownByKey) element).bindingOfSelectedKey();
              if (element instanceof IWDAbstractInputField)
                   return ((IWDAbstractInputField) element).bindingOfValue();
              if (element instanceof IWDCaption)
                   return ((IWDCaption) element).bindingOfText();
              if (element instanceof IWDCheckBox)
                   return ((IWDCheckBox) element).bindingOfChecked();
              if (element instanceof IWDLink)
                   return ((IWDLink) element).bindingOfText();
              if (element instanceof IWDProgressIndicator)
                   return ((IWDProgressIndicator) element).bindingOfPercentValue();
              if (element instanceof IWDRadioButton)
                   return ((IWDRadioButton) element).bindingOfSelectedKey();
              if (element instanceof IWDTextEdit)
                   return ((IWDTextEdit) element).bindingOfValue();
              if (element instanceof IWDTextView)
                   return ((IWDTextView) element).bindingOfText();
              return null;
          * Instance of a comparator according to the ordering imposed by the
          * implementation of <code>Comparable</code>.
         private static final Comparator DEFAULT = new Comparator() {
               * Compares the given objects according to the ordering imposed by the first
               * ones <code>compareTo(Object)</code> function. Furthermore, <code>null</code>
               * is treated to be less than any object.
               * @see java.lang.Comparable#compareTo(java.lang.Object)
               * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
              public int compare(Object o1, Object o2) {
                   if (o1 == null && o2 == null)
                        return 0;
                   if (o1 == null)
                        return -1;
                   if (o2 == null)
                        return +1;
                   if (o1 instanceof Boolean && o2 instanceof Boolean)
                        return o1.toString().compareTo(o2.toString()); // false < true
                   if (o1 instanceof String && o2 instanceof String){
                        //Use a Collator for sorting according to the given Locale
                        Collator collate = Collator.getInstance(WDResourceHandler.getCurrentSessionLocale());
                        return collate.compare(o1, o2);                    
                   return ((Comparable) o1).compareTo((Comparable) o2);
          * Map of table column to comparator (<code>ReversableComparator</code>)
          * used for sorting that column (sortable columns only).
         private Map comparatorForColumn = new HashMap();
          * The table to be sorted.
         private IWDTable table = null;
          * Column-IDs of the columns, which should be sortable
         private Map sortableCols = null;
          * Generic comparator that compares node elements by a given attribute with
          * the help of a given comparator.
         public final class NodeElementByAttributeComparator implements Comparator {
               * Creates a new comparator for the given attribute name that compares values
               * of that attribute according to the natural ordering of that attribute's
               * type (which must implement <code>java.lang.Comparable</code>).
              public NodeElementByAttributeComparator(String attributeName) {
                   this(attributeName, null, false, new ArrayList());
               * Creates a new comparator for the given attribute name that compares values
               * of that attribute with the help of the given comparator. If no comparator
               * is given, the natural ordering of that attribute's type is used.
              public NodeElementByAttributeComparator(String attributeName, Comparator comparator) {
                   this(attributeName, comparator, false, new ArrayList());
               * Creates a new comparator for the given attribute name that compares values
               * of that attribute either as objects (i.e. "in internal format") or as text
               * (i.e. "in external format") as indicated. The ordering is the natural
               * ordering of that attribute's type (which must implement
               * <code>java.lang.Comparable</code>) in case objects are compared or the
               * natural ordering of <code>java.lang.String</code> in case texts are compared.
              public NodeElementByAttributeComparator(String attributeName, boolean compareAsText) {
                   this(attributeName, null, compareAsText, new ArrayList());
               * Creates a new comparator for the given attribute name that compares values
               * of that attribute according to the natural ordering of that attribute's
               * type (which must implement <code>java.lang.Comparable</code>). In addition it is possible
               * to define the path to a child node with the <code>java.util.Collection</code> subnodes.
               * (List of child node names in the correct order)
              public NodeElementByAttributeComparator(String attributeName, Collection subnodes) {
                   this(attributeName, null, false, subnodes);
               * Creates a new comparator for the given attribute name that compares values
               * of that attribute with the help of the given comparator. If no comparator
               * is given, the natural ordering of that attribute's type is used. In addition it is possible
               * to define the path to a child node with the <code>java.util.Collection</code> subnodes.
               * (List of child node names in the correct order)
              public NodeElementByAttributeComparator(String attributeName, Comparator comparator, Collection subnodes) {
                   this(attributeName, comparator, false, subnodes);
               * Creates a new comparator for the given attribute name that compares values
               * of that attribute either as objects (i.e. "in internal format") or as text
               * (i.e. "in external format") as indicated. The ordering is the natural
               * ordering of that attribute's type (which must implement
               * <code>java.lang.Comparable</code>) in case objects are compared or the
               * natural ordering of <code>java.lang.String</code> in case texts are compared. In addition it is possible
               * to define the path to a child node with the <code>java.util.Collection</code> subnodes.
               * (List of child node names in the correct order)
              public NodeElementByAttributeComparator(String attributeName, boolean compareAsText, Collection subnodes) {
                   this(attributeName, null, compareAsText, subnodes);
               * Internal constructor.
              private NodeElementByAttributeComparator(
                   String attributeName,
                   Comparator comparator,
                   boolean compareAsText,
                   Collection subNodes) {
                   if (attributeName == null)
                        throw new IllegalArgumentException("Attribute name must not be null");
                   if (comparator == null)
                        comparator = DEFAULT;
                   this.attributeName = attributeName;
                   this.comparator = comparator;
                   this.compareAsText = compareAsText;
                   this.sortDirection = true;
                   this.subNodes = subNodes;
               * Sets the sort direction of this comparator to the given direction. The comparator sort in ascending order by default.
               * @see com.sap.tc.webdynpro.clientserver.uielib.standard.api.WDTableColumnSortDirection
              public void setSortDirection(WDTableColumnSortDirection direction){
                   if(direction.equals(WDTableColumnSortDirection.UP)){
                        sortDirection = true;
                   }else if(direction.equals(WDTableColumnSortDirection.DOWN)){
                        sortDirection = false;
               * Compares the given objects which must be instances of <code>IWDNodeElement</code>
               * according to the values of the attribute given at construction time
               * with the help of the comparator given at construction time.
               * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
               * @see com.sap.tc.webdynpro.progmodel.api.IWDNodeElement
              public int compare(Object o1, Object o2) {
                   IWDNodeElement element1 = (IWDNodeElement) o1;
                   IWDNodeElement element2 = (IWDNodeElement) o2;
                   if(subNodes.size() > 0){
                        element1 = getSubNodeElement(element1, 0);
                        element2 = getSubNodeElement(element2, 0);
                   Object attributeValue1 = null;
                   Object attributeValue2 = null;
                   if(element1 != null){
                        attributeValue1 =
                             compareAsText
                                  ? element1.getAttributeAsText(attributeName)
                                  : element1.getAttributeValue(attributeName);
                   if(element2 != null){
                        attributeValue2 =
                             compareAsText
                                  ? element2.getAttributeAsText(attributeName)
                                  : element2.getAttributeValue(attributeName);
                   if(sortDirection){
                        return comparator.compare(attributeValue1, attributeValue2);
                   }else{
                        return comparator.compare(attributeValue2, attributeValue1);
               * Determines recursivly the child node, which have an attribute with the given name.
               * The path to this child node must be specified in the subnodes property of this comparator.
               * Start this method with index = 0.
              private IWDNodeElement getSubNodeElement(IWDNodeElement currentElement, int index){
                   if(currentElement == null || index >= subNodes.size()){
                        //end of recursion
                        return currentElement;
                   }else{
                        return getSubNodeElement(currentElement.node().getChildNode((String)subNodes.toArray()[index], currentElement.index()).getCurrentElement(), index+1);
                        //return getSubNodeElement(currentElement.node().getChildNode((String)subNodes.toArray()[index], currentElement.index()).getElementAt(0), index+1);
               * Name of the attribute used for comparisons.
              private final String attributeName;
               * Comparator used for comparing the attribute's values.
              private final Comparator comparator;
               * Indicates whether attribute values are compared as text (as opposed to
               * "as objects").
              private final boolean compareAsText;
               * Sort direction (true = ascending order, false = descending order)
              private boolean sortDirection;
               * List of child node names
               * (Description of the path from the given context node to the specified attribute)
              private Collection subNodes;
    Re: Webdynpro Table: Column Header sort icon not visible
    Regards,
    Mithu

  • Disabling sorting for a table

    Hi All,
    I want to disable the sorting function for my table. How can I achieve this? Please help...!!!
    -sps

    If you are using a JTable, by default row sorting is unable. Infact, to provide you the Table sorting, you have to put the line
    JTable table = new JTable (...);
    table.setAutoCreateSorter (true) //this enableinto your code or writing a RowSorter.
    Otherwise there's no sorter for the Table and you can't do any kind of sorting.
    Regards,
    Maurizio

  • Custom table model, table sorter, and cell renderer to use hidden columns

    Hello,
    I'm having a hard time figuring out the best way to go about this. I currently have a JTable with an custom table model to make the cells immutable. Furthermore, I have a "hidden" column in the table model so that I can access the items selected from a database by their recid, and then another hidden column that keeps track of the appropriate color for a custom cell renderer.
    Subject -- Sender -- Date hidden rec id color
    Hello Pete Jan 15, 2003 2900 blue
    Basically, when a row is selected, it grabs the record id from the hidden column. This essentially allows me to have a data[][] object independent of the one that is used to display the JTable. Instinctively, this does not seem right, but I don't know how else to do it. I know that the DefaultTableModel uses a Vector even when it's constructed with an array and I've read elsewhere that it's not a good idea to do what I'm trying to do.
    The other complication is that I have a table sorter as well. So, when it sorts the objects in the table, I have it recreate the data array and then set the data array of the ImmutableTableModel when it has rearranged all of the items in the array.
    On top of this, I have a custom cell renderer as well. This checks yet another hidden field and displays the row accordingly. So, not only does the table sort need to inform the table model of a change in the data structure, but also the cell renderer.
    Is there a better way to keep the data in sync between all of these?

    To the OP, having hidden columns is just fine, I do that all the time.. Nothing says you have to display ALL the info you have..
    Now, the column appears to be sorting properly
    whenever a new row is added. However, when I attempt
    to remove the selected row, it now removes a seemingly
    random row and I am left with an unselectable blank
    line in my JTable.I have a class that uses an int[] to index the data.. The table model displays rows in order of the index, not the actual order of the data (in my case a Vector of Object[]'s).. Saves a lotta work when sorting..
    If you're using a similar indexing scheme: If you're deleting a row, you have to delete the data in the vector at the INDEX table.getSelectedRow(), not the actual data contained at
    vector.elementAt(table.getSelectedRow()). This would account for a seemingly 'random' row getting deleted, instead of the row you intend.
    Because the row is unselectable, it sounds like you have a null in your model where you should have a row of data.. When you do
    vector.removeElementAt(int), the Vector class packs itself. An array does not. If you have an array, when you delete the row you must make sure you dont have that gap.. Make a new array of
    (old array length-1), populate it, and give it back to your model.. Using Vectors makes this automatic.
    Also, you must make sure your model knows the data changed:
    model.fireTableDataChanged(); otherwise it has no idea anything happened..
    IDK if that's how you're doing it, but it sounds remarkably similar to what I went thru when I put all this together..

  • Logistics Extractor for NW04S ( SALES, BILLING , PAYMENT etc)

    Hi,
      I would like to know whether the same set of logistics extractor( example 2LIS_11_VAHDR, 2LIS_11_VAITM )  that were used in 3.5BW as well as the Old table( like VBAK, VBAP for sale order header and item etc) are still used in BI for NW04S?
    Also Can anybody let me know the a> Data source b> Data store/cube etc c> Additional configuration for the logistic cockpit to enable the following in NW04S
    1> Sales Doc (header, detail, schedule line, condition)
    2> Billing, credit and debit memo
    3> Acct Payables payments
    Thanks in advance
    BPSIP

    Hi,
    I dont think it has changed in NW04S.
    Refer.
    LO Cockpit (Use transaction LBWE)
    /people/vikash.agrawal/blog/2006/12/18/one-stop-shop-for-all-your-lo-cockpit-needs
    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/u/21406 [original link is broken] [original link is broken]
    /people/sap.user72/blog/2005/09/05/sap-bw-and-business-content-datasources-in-pursuit-of-the-origins
    To understand LO extraction go through these weblogs by Roberto
    /people/sap.user72/blog/2004/12/16/logistic-cockpit-delta-mechanism--episode-one-v3-update-the-145serializer146
    /people/sap.user72/blog/2004/12/23/logistic-cockpit-delta-mechanism--episode-two-v3-update-when-some-problems-can-occur
    /people/sap.user72/blog/2005/01/19/logistic-cockpit-delta-mechanism--episode-three-the-new-update-methods
    /people/sap.user72/blog/2005/02/14/logistic-cockpit--when-you-need-more--first-option-enhance-it
    /people/sap.user72/blog/2005/04/19/logistic-cockpit-a-new-deal-overshadowed-by-the-old-fashioned-lis
    Thanks,
    JituK

  • Old transport request for sap script (form)

    Hi,
    I want to find the old transport request for the sapscript(form). Just now it has been over written by the latest CTR. So i need to transport the old one.
    How to find out the old transport request.
    Thanks,

    Try giving the script name in OBJ_NAME field in table E071 and then execute and it will give you a list of all transports. You can sort it in descending and see the order of transports.
    Thanks,
    Srinivas

  • Text Overlapping/Wrapping Issue in BSP(Table Sorter Using JQUERY)

    Hi ,
    I have a requirement to add a new column in existing table which has been built by Table Sorter method in JQUERY.
    I have added the new column but the issue is value for the new column is populated  on next line of the table.
    This could be a simple width issue, but i don't know JAVA much.Attached the image for reference.
    Code i have used is:
    <input type="text" name="t_rbclaim[<%= lv_tabix%>].reason" size="3" maxlenth="3" wrapping = "true"
         onBlur="javascript:this.value=this.value.toUpperCase();" value="<%= w_rbclaim-reason%>">
    Please let me know how to modify the above code in better way.

    Hi Raja,
    Can you please help on this problem. I want to know whether there is any funciton module to convert the univercel character set code (HTML Codepage) page to SAP codepage. We are going to use ECC 6.0 which is unicode system for background R/3. So we can get the correct character format if identify the correct conversion method.
    Please let me know if any information and expect some information on this.
    Regards,
    Saravanan V

  • Table name for material master change

    What is the table name for material master change, so that I can get the old values and new values at plant level.
    More specific:
    I want to check the old values for Re order point and Safety stock in MRP1 and MRP2 fields in material master for many materials. Please help.

    Use CDPOS and CDHDR table to get the values which were changed.
    CDPOS>use fields Change doc. object give in as MATERIAL and in the Table name>MARC

  • Using dbms_xmlgen.getxml with new and old tables in triggers

    Is there a way to use getxml against the data stored in the new and old tables in a trigger? Simply doing this:
    Xml_Variable := dbms_xmlgen.getxml('Select * from New');
    Does not work.
    Edited by: user13302591 on Jun 16, 2010 1:16 PM

    user13302591 wrote:
    How would I pass the information from the :new and :old to getxml?What are you trying to do? You could use, for example:
    XMLELEMENT("old",:old.column_name)
    XMLELEMENT("new",:new.column_name)SY.

  • Problem with table sorting,

    Hi To All,
    I am having table,I am doing the sorting for this table using sql query order by.
    I have the code when i click on radi button with value="1",it is soring the table by ascending,and if click on the radio button with value="2",
    it is sorting in descending order.
    I want the code like,If i click on the arrow,Sorting should happen.Like if the records are in ascending order arow should be up and if i click on descending order arow should be down.
    can any body give me the idea.
    My code is as follows.
    <table>
    <th>
    <td >TestCase Name
    <select name="<%= TestCasesData.SORT_BY%>0">
    <option value="1" <%= (filterObject.getSortBy1()==1)? "selected":"" %>>TestCase Name</option>
    <input type="radio" name="<%= TestCasesData.RADIO %>0" value="1" <%= (filterObject.getAscDesc1()== 1)? "checked":"" %>>asc
    <input type="radio" name="<%= TestCasesData.RADIO %>0" value="2" <%= (filterObject.getAscDesc1()== 2)? "checked":"" %>>desc
    </td>
    <td>Created by
    <select name="<%= TestCasesData.SORT_BY%>0">
    <option value="1" <%= (filterObject.getSortBy1()==1)? "selected":"" %>>TestCase Name</option>
    <input type="radio" name="<%= TestCasesData.RADIO %>0" value="1" <%= (filterObject.getAscDesc1()== 1)? "checked":"" %>>asc
    <input type="radio" name="<%= TestCasesData.RADIO %>0" value="2" <%= (filterObject.getAscDesc1()== 2)? "checked":"" %>>desc
    </td>
    <td>Created Date
    <select name="<%= TestCasesData.SORT_BY%>0">
    <option value="1" <%= (filterObject.getSortBy1()==1)? "selected":"" %>>TestCase Name</option>
    <input type="radio" name="<%= TestCasesData.RADIO %>0" value="1" <%= (filterObject.getAscDesc1()== 1)? "checked":"" %>>asc
    <input type="radio" name="<%= TestCasesData.RADIO %>0" value="2" <%= (filterObject.getAscDesc1()== 2)? "checked":"" %>>desc
    </td>
    </th>
    <tr><td>--</td></tr>
    <tr><td>--</td></tr>
    <tr><td>--</td></tr>
    </table>

    I am using java
    Query is as follows
    for(int i=0;i<count;i++) {
    if((radio[i] == 1 || radio[i] == 2) && (sortBy[i] != -1)) {
    if(entered) {
    query.append(" order by ");
    entered = false;
    if(sortBy[i] == 1) {
    query.append(" test_case ");
    } else if(sortBy[i] == 2) {
    query.append(" cre_user ");
    } else if(sortBy[i] == 3) {
    query.append(" cre_date ");
    if(radio[i] == 1) {
    query.append(" asc , ");
    } else if(radio[i] == 2){
    query.append(" desc , ");
    query.append(" cre_date desc ");
    and i am getting parameter like as follows
    for(int i=0;i<count;i++) {
    if(request.getParameter(TestCasesData.SORT_BY+i) != null)
    testCasesData.sortBy[i] = Integer.parseInt(request.getParameter(TestCasesData.SORT_BY+i));
    System.out.println(testCasesData.sortBy);
                             if(request.getParameter(TestCasesData.RADIO+i) != null)
    testCasesData.radio[i] = Integer.parseInt(request.getParameter(TestCasesData.RADIO+i));
    and my java bean as follows
    package com.DB.RPT.Calc.TestReport.Web;
    public class FilterObject {
         //     fields available in search_criteria.jsp
         private String testCaseName="";
         private String createUser="";
         private String fromDate="";
         private String toDate="";
         private int sortBy1=1;
         private int sortBy2;
         private int sortBy3;
         private boolean isUserListEnabled;
         private int ascDesc1=1;
         private int ascDesc2;
         private int ascDesc3;
         public FilterObject() {
         public void resetForm() {          
              testCaseName="";
              createUser="";
              fromDate="";
              toDate="";
              sortBy1=1;
              sortBy2=0;
              sortBy3=0;
              isUserListEnabled=false;
              ascDesc1=1;
              ascDesc2=0;
              ascDesc3=0;
         public String getFromDate() {
              return fromDate;
         public void setFromDate(String fromDate) {
              this.fromDate = fromDate;
         public String getTestCaseName() {
              return testCaseName;
         public void setTestCaseName(String testCaseName) {
              this.testCaseName = testCaseName;
         public String getToDate() {
              return toDate;
         public void setToDate(String toDate) {
              this.toDate = toDate;
         public int getAscDesc1() {
              return ascDesc1;
         public void setAscDesc1(int ascDesc1) {
              this.ascDesc1 = ascDesc1;
         public int getAscDesc2() {
              return ascDesc2;
         public void setAscDesc2(int ascDesc2) {
              this.ascDesc2 = ascDesc2;
         public int getAscDesc3() {
              return ascDesc3;
         public void setAscDesc3(int ascDesc3) {
              this.ascDesc3 = ascDesc3;
         public int getSortBy1() {
              return sortBy1;
         public void setSortBy1(int sortBy1) {
              this.sortBy1 = sortBy1;
         public int getSortBy2() {
              return sortBy2;
         public void setSortBy2(int sortBy2) {
              this.sortBy2 = sortBy2;
         public int getSortBy3() {
              return sortBy3;
         public void setSortBy3(int sortBy3) {
              this.sortBy3 = sortBy3;
         public String getCreateUser() {
              return createUser;
         public void setCreateUser(String createUser) {
              this.createUser = createUser;
         public boolean getIsUserListEnabled() {
              return isUserListEnabled;
         public void setIsUserListEnabled(boolean isUserListEnabled) {
              this.isUserListEnabled = isUserListEnabled;
    If you want any clarificaton please ask me

  • Af:table sorting when immediate='true' bug

    Where can I find the patch to fix the problem of sorting an af:table when immediate='true'?

    No I don't have a bug number, I've found that this is a bug based on this thread <a href src='BUG:  ADF FACES 10.1.3_04: Table sort broken if immediate="true" but I have no idea what the number is or where to find the patch for it.
    This is a really irritating bug. I want to have sorting on my tables but if I can't put immediate='true' on the table then other components on the page will fire their validation.

  • Can't add row using table sorter

    I had a jtable with my own mytableModel that implements AbstractTableModel. In mytableModel, I have addRow, removeRow... so I can delete/add row dynamically by calling mytableModel.addRow(..). Everything works fine.
    However, after I added the table sorter and table map (got the code from the tutorial).
    MyTableModel myModel = new MyTableModel();
    TableSorter sorter = new TableSorter(myModel);
    JTable table = new JTable(sorter);
    sorter.addMouseListenerToHeaderInTable(table);
    Now, when i call mytableModel.addRow(..), it doesn't work anymore. It doesn't add a row anymore, why?
    Thank you so much for your help.

    I don't have a addRow method in TableSorter. My addRow method is in myTableModel. So, when I need to addRow, I called myTableModel.addRow, In my addRow method, I have fireTableRowsInserted method. This used to work using integrating with TableSorter.
    Do I need to move all my addRow, addCol....DelRow... to TableSorter? The table data are stored in myTableModel. I guess I really doesn't know how the TableSorter work :(
    Thanks

Maybe you are looking for

  • Would sorting in UNIX faster than using order by?

    Hi all, recently I was trying to optimize a query that returns a million rows. After using explain plan, I found that the 'order by' (3 columns needed) clause contributes to a significant portion of the cost. I wonder if the process can be speed up b

  • Change Normal account (having balances) to Reconciliation Account

    Hi, Clinet want to change the normal GL account ("27500000" which has alredy using for normal transaction and posted balance amount are exist in the system) to Reconciliation account.  How It is possible? It must has zero balance to change the gl to

  • How does a Image is linked to a FI Document (via Archivelink)?

    For Incoming Invoices, Normally we link to external Image system via Archivelink. Document types are linked to Business Object and thereby the transaction code SOA0.  In general, whenever the document is posted via transaction code the link to the im

  • Problems with Email Signature in Outlook

    Hi everyone, I've been trying to create an email signature for my office that can be viewed correctly in any browser/ email client/ platform. I'm currently designing/ coding on a Mac. I created the design for it in Photoshop and then sliced it approp

  • N97 Mini Charger Problem

    Hi there, I want to know if anyone else have the same problem as I? I bought the phone about 3 weeks now, and been through all the crashes, frustrations and pulling my hair out. I am pretty much over that stage already. But here comes my next problem