Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the option to Clear Selected Records #73

Merged

Conversation

carrbrpoa
Copy link
Contributor

Added to the Clear Menu, this option clears the selected records from
Table and graphics related to it.

This PR is related to issue 71.

Added to the Clear Menu, this option clears the selected records from
Table and graphics related to it.
layer.remove(graphic);
});

topic.publish(this.attributesContainerID + '/recordsRemoved', layer.graphics);
Copy link
Contributor Author

@carrbrpoa carrbrpoa Sep 29, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had some doubts about it (the publish of /recordsRemoved), but since I needed to fire some event about it, I decided to publish this new topic.

Copy link
Owner

@tmcgee tmcgee Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this topic should be /graphicsRemoved and a separate topic rowsRemoved published in the clearSelectedGridRecords method (or the proposed name clearSelectedGridRows) for publishing the grid rows that were removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with everything. Due to my needings, I was publishing remaining graphics. Do I keep it? Remaining/removed graphics/rows?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right. I was looking at that backwards. To be consistent, how about publishing the topic like this as it is done elsewhere:

topic.publish(this.attributesContainerID + '/tableUpdated', this);

It would then only need to be called once instead of in the two places as I had suggested.

I recognize your code elsewhere would need to use something like args.featureGraphics.graphics instead of just args

Copy link
Contributor Author

@carrbrpoa carrbrpoa Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since _FeaturesMixin's clearFeatures already publishes tableUpdated, I guess I don't need to publish it again. In my specific version, I'll keep publishing those custom topics.

@tmcgee
Copy link
Owner

tmcgee commented Sep 29, 2016

Thanks @carrbrpoa! Will review when I am in the office.

Copy link
Owner

@tmcgee tmcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@carrbrpoa I provided a few suggested changes.

}
this.setToolbarButtons();
topic.publish(this.attributesContainerID + '/tableUpdated', this);

},

clearSpecificFeatures: function (layer, specificFeatures) {
Copy link
Owner

@tmcgee tmcgee Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method should be named clearSpecificGraphics since it is not specific to Features and can be used for any of the graphic layers.

@@ -648,15 +648,45 @@ define([
this.clearGraphicsLayer(this.bufferGraphics);
},

clearGraphicsLayer: function (layer) {
clearGraphicsLayer: function (layer, specificFeatures) {
Copy link
Owner

@tmcgee tmcgee Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the argument should be specificGraphics so it can be generalized for any graphic layer.

layer.remove(graphic);
});

topic.publish(this.attributesContainerID + '/recordsRemoved', layer.graphics);
Copy link
Owner

@tmcgee tmcgee Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this topic should be /graphicsRemoved and a separate topic rowsRemoved published in the clearSelectedGridRecords method (or the proposed name clearSelectedGridRows) for publishing the grid rows that were removed.

@@ -302,6 +302,15 @@ define([
this.gridOptions.sort = [];
},

clearSelectedRecords: function () {
Copy link
Owner

@tmcgee tmcgee Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should method be renamed to clearSelected or similar since it included graphics and isn't specific to just dgrid rows or dstore records?

@@ -419,6 +419,29 @@ define([
}
this.setToolbarButtons();
topic.publish(this.attributesContainerID + '/tableUpdated', this);
},

clearSelectedGridRecords: function () {
Copy link
Owner

@tmcgee tmcgee Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be clearSelectedGridRows to be consistent with dgrid's use of rows, not records in a dstore.

@tmcgee tmcgee merged commit fa14c35 into tmcgee:master Oct 5, 2016
@tmcgee
Copy link
Owner

tmcgee commented Oct 5, 2016

@carrbrpoa Thank you for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants