P
P
peaches072019-10-15 15:42:24
Angular
peaches07, 2019-10-15 15:42:24

How to add color change functionality to Sir Trevor JS?

There is a site on yii1 + sir trevor js 3.0
I just can't add the functionality to change the color. The button appeared, I don’t know what to do next. Settled on this:

var Color = SirTrevor.Formatter.extend({
      title: "color",
      cmd: "color",
      text : "C",
      onClick: function() {
          var color = prompt(i18n.t("general:color"));

          document.execCommand(this.cmd, false, color);
      }
});
 SirTrevor.Formatters.Color = new Color();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Eremin, 2018-07-24
@zachfischer

And why don't you immediately filter the entire collection in the place where you fill in filteredMonitorings?

this.monitoringsService.getFilteredMonitorings().subscribe(rows =>
      this.filteredMonitorings = rows
        .filter(monitoring => monitoring.spr_prioritys_id)
        .filter(monitoring => monitoring.n_users_id)
        .filter(monitoring => monitoring.priority_itog));

I asked this question based on your line
Because you are checking here that monitoring.spr_prioritys_id is not null, and that monitoring.n_users_id and monitoring.priority_itog are also not null or 0
according to https://dorey.github.io/JavaScript-Equality-Table/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question