FEATURE: Add user custom fields to user directory (PR #13238)

GitHub

This sorts all the columns with automatic_position to the top, then orders the user_field columns properly based on their position. If we ever got over 1000 automatic columns by default we have lost our way and are out of business

We can’t have a default value for the query param, because the columns are dynamic. Have to wait until the columns are loaded, then use the first column as the default order

I like the pattern of the child calling up to this action, but I think id is inefficient. In the child you could pass this.element, then you wouldn’t need to getElementById. You might not need an id at all in the child.

It’s looking good! Can’t wait to see it in action.

This could be this.element no?

I think headerDidRender might be more descriptive here.

I sent you a message about this, but I think this can be removed and we can use the {{get}} helper instead.

I wonder if these helpers might be better as simple components. I’m on the fence. I suspect we can try it for now.

Trivial, but this if block could be one line: params.order = params.order || columns[0].name;

This is repeated almost line for line in an earlier component. Maybe make a component to DRY it up?

Looks like this comment was left in by mistake.

I am always suspicious of tables without indexes. I know this table is likely to be small but we should add indexes anyway. I recommend enabled, position, but if it’s ever filtered by user_field_id that might be a good idea too.

I swear this.element was null, thats why I did this mess. I tried it again and now I can access it without directly accessing the dom. Fantastic!

same as above, idk what was going on.

That’s not really true though. It’s only on render, when the header is “active”, meaning the table is being ordered by that header.

Oh I see, that makes sense. Carry on!

I think you’re talking about this:

Which looks visually the same as this

But use all different helpers

@eviltrout I fixed the things you mentioned. One other thing I realized is that I would have allowed disabling all columns, so I added a check in the controller.

My bad! Sorry.