Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5997897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:19:45+00:00 2026-05-23T00:19:45+00:00

I have a View where I have Drag and Drop working between 2 ListGrid-s,

  • 0

I have a View where I have Drag and Drop working between 2 ListGrid-s, and after dragging a few records I then save them to a POJO type object upon clicking a button “Save”.

When I’m accessing again that view it calls a method loadGrid that pulls those values from the POJO and adds them back into the ListGrid that they were dragged to earlier, so they can see what they already have added previously, however when I drag and drop again it lets me add the same primary keys creating duplicates records in the ListGrid.

How can I make it so that it sees these records as the same? The primary key is the same, the types are the same, not sure what it could be…

I’m using transferSelectedData to add the new privileges to the assigned list grid and setPreventDuplicates(true).

ListGrid avPrivGrid = null;
 ListGrid assPriv = null;
 TransferImgButton but = null;

 avPrivGrid = new ListGrid();
 PrivilegesDataSource privDataSource = new PrivilegesDataSource();
 avPrivGrid.setDataSource(privDataSource);
 avPrivGrid.setAutoFetchData(false);

 ListGridField propUsername = new ListGridField("privName", "Available Priv");
 propUsername.setType(ListGridFieldType.TEXT);
 avPrivGrid.setFields(propUsername);

 assPriv = new ListGrid();
 assPriv.setCanAcceptDroppedRecords(true);
 assPriv.setCanEdit(false); 
 assPriv.setAutoFetchData(false);
 assPriv.setPreventDuplicates(true);
 assPriv.setDuplicateDragMessage("Can not add duplicates!");
 assPriv.setCanSelectAll(false);
 assPriv.setAlternateRecordStyles(true);
 assPriv.setLeaveScrollbarGap(true);
 assPriv.setMinHeight(100);

 ListGridField propUserN = new ListGridField("privName", "Assigned Priv");
 propUserN.setWidth("30%");
 propUserN.setType(ListGridFieldType.TEXT);
 ListGridField propId = new ListGridField("privId");
 propId.setWidth("30%");
 propId.setType(ListGridFieldType.TEXT);
 propId.setHidden(true);
 assPriv.setFields(propId, propUserN);

 but = new TransferImgButton(TransferImgButton.RIGHT);
  but.addClickHandler(new ClickHandler()
 {
    public void onClick(ClickEvent event)
    {
        //Duplicate checking will happen automagially!
            assPriv.transferSelectedData(avPrivGrid);
    }
 });
 avPrivGrid.fetchData();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T00:19:46+00:00Added an answer on May 23, 2026 at 12:19 am

    Check if the ID field set as the primary key in the Datasource.

    [IdField].setPrimaryKey(true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a View class (extends ViewPart ) that contains a ScrolledForm created from
I am trying to drag a view over the screen FrameLayout main = (FrameLayout)
Got an annoying problem here. I've got an NHibernate/Forms application I'm working through SVN.
Say I have a listview control with several items in it. How would I
I have an html page. On that page I want to open popup window.
I can get button presses etc in Iphone. Is there away to catch drag
I am working on an iPhone SDK project using Xcode 4 Preview. I am
I still consider myself a novice with javascript...so be gentle :) Is there a
Using the Qt Designer I've made a couple of QFrames in each other, each
I'm new to developing in iOS and successfully ran through a tutorial on how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.