문제

각 행에 3 개의 텍스트 입력 상자가있는 99 개의 행을 표시하는 큰 '주문 양식'XPAGE가 있습니다. 변경 사항을 캡처하기 위해 각 입력 상자의 'Onchange'이벤트에서 SSJS 기능을 호출했습니다. 통화는 단순히 제품 ID, 변경 유형 (열) 및 수량을 보냅니다. 그런 다음 SSJS 함수는 SessionsCope 변수 (java.util.hashmap)의 변경 사항을 유지합니다. 변경과 관련된 새로 고침은 없습니다.

사용자가 '제출'버튼을 클릭하면 변경 사항이 대량으로 처리됩니다. 이것은 백엔드 도미노 데이터베이스에 모든 변경 사항을 단순히 작성하는 또 다른 SSJS 기능입니다.

그것은 모두 잘 작동하는 것처럼 보이고 몇 년 동안 해왔습니다. 그러나 내 사용자가 응용 프로그램에 너무 효율적으로되어 있고 유지할 수있는 것보다 더 빨리 타이핑하고있는 것 같습니다.

내 디버그 코드는 각 변경 사항을 서버의 콘솔에 기록하며 사용자가 빠른 연속으로 변경하면 일부 변경 사항이 무시되는 위치를 확인할 수 있습니다 (입력 상자 사이에 단순히 탭). 마치 서버가 이전 변경을 처리하는 데 너무 바빠서 다른 사람으로 이동하기 위해 건너 뜁니다. 때때로, 전체 변경 블록이 놓친 다음 응용 프로그램이 가능하면 다시 선택됩니다.

변경 사항을 캡처하기 위해 잘못된 기술을 사용하고 있습니까? 애플리케이션이 매번 OnChange 이벤트를 시작하도록하기 위해 할 수있는 일이 있습니까?

IE8/9 & FF24를 사용하여 이것을 테스트했습니다. 대신 'OnkeyUp'이벤트를 사용하는 다른 게시물을 살펴 보았습니다. 사용자가 두 자리 수량을 주문할 수 있으므로 제 경우에는 그것이 효과가 있다고 생각하지 않습니다.

모든/모든 제안은 감사하게 감사 할 것입니다!

도움이 되었습니까?

해결책

테리, 건축을 다시 방문해야합니다. 제출시 업데이트가 처리되면 Tim이 지적한 것처럼 왜 서버로 개별적으로 보내는가? 내가 할 일 :

  • 2 개의 Java 클래스 만들기 : 하나의 "주문"One "Lineitem"
  • 주문 클래스가 맵 인터페이스 맵을 구현하도록하십시오
  • 반복 제어를 위해 주문 클래스를 사용하십시오 (각 lineitem의 키를 반복 변수로 제공합니다).
  • 반복 내부의 필드를 주문하기 위해 묶음 [반복 키] .FieldName
  • 객체 데이터 소스에서 순서를 사용하십시오
  • 주문 클래스에서 저장 메소드를 구현하고 객체 데이터 소스의 저장 메소드에서 호출하십시오.

매우 정교한 개요, 내가 정교하게 해야하는지 알려주세요. Java Collections 프레임 워크는 친구입니다.

보이는 것보다 쉽습니다.

   public class LineItem {

private String unid;
private String partno;
private int quantity;
private long unitprice;

/**
 * Constructor for new items
 */
public LineItem() {
    this.unid = null;
}

/**
 * Constructor for existing items
 */
public LineItem(Document doc) {
    this.unid = doc.getUniversalId();
    // more here
}


/**
 * @return the unid
 */
public String getUnid() {
    return this.unid;
}

/**
 * @return the partno
 */
public String getPartno() {
    return this.partno;
}
/**
 * @param partno the partno to set
 */
public void setPartno(String partno) {
    this.partno = partno;
}
/**
 * @return the quantity
 */
public int getQuantity() {
    return this.quantity;
}
/**
 * @param quantity the quantity to set
 */
public void setQuantity(int quantity) {
    this.quantity = quantity;
}
/**
 * @return the unitprice
 */
public long getUnitprice() {
    return this.unitprice;
}
/**
 * @param unitprice the unitprice to set
 */
public void setUnitprice(long unitprice) {
    this.unitprice = unitprice;
}

public void save(Database db) {
    Document doc = null;
    if (this.unid == null) {
        doc = db.createDocument();
        doc.replaceItem("Form", "LineItem");
    }
    doc.replaceItem("PartNo", this.partno);
    // More here
    doc.save();
}
}

그리고 주문의 경우 - 문서 컬렉션에서로드하는 것으로 가정합니다.

public class Order implements Map<String, LineItem> {

// You might want to have a stack here to keep order
private final Map<String, LineItem> backingMap          = new LinkedHashMap<String, LineItem>();
private final Set<String>           deletedItemKeys     = new HashSet<String>();

// The key we use for new items when unid is null
private int                         lastNewItemNumber   = 0;

@Override
public int size() {
    return this.backingMap.size();
}

@Override
public boolean isEmpty() {
    return this.backingMap.isEmpty();
}

@Override
public boolean containsKey(Object key) {
    return this.backingMap.containsKey(key);
}

@Override
public boolean containsValue(Object value) {
    return this.backingMap.containsValue(value);
}

@Override
public LineItem get(Object key) {
    return this.backingMap.get(key);
}

@Override
public LineItem put(String key, LineItem value) {
    // Here it gets a little special
    // We need to prevent null keys
    if (key == null) {
        key = String.valueOf(this.lastNewItemNumber);
        lastNewItemNumber++;
    }
    this.deletedItemKeys.remove(key);
    return this.backingMap.put(key, value);
}

@Override
public LineItem remove(Object key) {
    this.deletedItemKeys.add(key.toString());
    return this.backingMap.remove(key);
}

@Override
public void putAll(Map<? extends String, ? extends LineItem> m) {
    for (Map.Entry<? extends String, ? extends LineItem> me : m.entrySet()) {
        this.put(me.getKey(), me.getValue());
    }
}

@Override
public void clear() {
    this.deletedItemKeys.addAll(this.backingMap.keySet());
    this.backingMap.clear();
}

@Override
public Set<String> keySet() {
    return this.backingMap.keySet();
}

@Override
public Collection<LineItem> values() {
    return this.backingMap.values();
}

@Override
public Set<java.util.Map.Entry<String, LineItem>> entrySet() {
    return this.backingMap.entrySet();
}

public void load(NotesDocumentCollection dc) throws NotesException {
    Document doc = dc.getFirstDocument();
    Document nextDoc;
    while (doc != null) {
        nextDoc = dc.getNextDocument(doc);
        LineItem li = new LineItem(doc);
        this.put(doc.getUniversalId(), li);
        doc.recycle();
        doc = nextDoc;
    }

    doc.recyle();
}

public void save(Database db) {
    for (LineItem item : this.backingMap.values()) {
        item.save(db);
    }

    // Now kill the left overs - needs error handling
    for (String morituri : this.deletedItemKeys) {
        Document delDoc = db.getDocumentByUnid(morituri);
        if (delDoc != null) {
            delDoc.remove(true);
        }
    }       
}
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top