Commit 4179480d authored by Nugraha, Sigit's avatar Nugraha, Sigit
Browse files

Fix create new question jump to beginning

parent 02447a28
Pipeline #15367 passed with stage
in 1 minute and 36 seconds
......@@ -1828,6 +1828,16 @@ public class QuestionnaireEditorView extends VerticalLayout implements View, Tra
setRunFilltreeAfterEdit( false );
questionGrid.getDataProvider().refreshAll();
if ( goal.endsWith( QuestionWindow.WINDOW_NAME ) ) {
if (args.get("id") != null) {
final QuestionGridRow questionGridRowToBeSelected = questionGridRows.stream()
.filter(qgr -> qgr.getId().equals(args.get("id"))).findFirst()
.orElse(null);
if (questionGridRowToBeSelected != null)
questionGrid.select(questionGridRowToBeSelected);
}
}
}
}
......
......@@ -10,6 +10,7 @@ import com.vaadin.ui.*;
import com.vaadin.ui.Grid.SelectionMode;
import com.vaadin.ui.themes.ValoTheme;
import org.gesis.stardat.DDIEditor;
import org.gesis.stardat.ddiflatdb.client.DDIStore;
import org.gesis.stardat.entity.*;
import org.gesis.stardat.events.EditorEvent;
import org.gesis.stardat.helper.TriggerableWindowMaster;
......@@ -1296,13 +1297,16 @@ public class QuestionWindow extends BaseStoreCancelWindow implements Translatabl
}
}
storeQuestionConstruct( comment );
final String constructId = storeQuestionConstruct(comment);
master.readyWith( GOAL + windowName, true, null );
HashMap<String, Object> args = new HashMap<>();
args.put("id", constructId);
master.readyWith( GOAL + windowName, true, args );
return true;
}
private void storeQuestionConstruct( String comment )
private String storeQuestionConstruct( String comment )
{
if ( currentInterviewerInstruction != null && !currentInterviewerInstruction.getId().isEmpty() )
{
......@@ -1338,7 +1342,10 @@ public class QuestionWindow extends BaseStoreCancelWindow implements Translatabl
construct.getUniverse().setDdiStore( getEntityService().saveElement( construct.getUniverse(),
getDDIEditor().getCurrentUserId(), comment ));
construct.save();
construct.setDdiStore( getEntityService().saveElement( construct, getDDIEditor().getCurrentUserId(), comment ));
final DDIStore ddiStore = getEntityService().saveElement(construct, getDDIEditor().getCurrentUserId(), comment);
construct.setDdiStore( ddiStore );
return ddiStore.getElementId();
}
private void storeMultipleQuestionItem( String comment )
......
Supports Markdown
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