I'm currently trying to do :on-DOMCharacterDataModified so that I can see when a [:div] with {:contentEditable true} is edited.
How can I do this or should I be approaching this problem differently? I'm using this type of text input field so that I can highlight parts of the text input with different colors.
:on-input worked and then using (-> e .-target .-innerHTML) or (-> e .-target .-innerText) will get the new value.
Related
Hi I have a report that i used a wild card search parameter so that i can pull record that contains a certain text.
For example: I need to search for subscription for Mary Johnson so on the keyword search box i just type "John". This set-up is working fine, but now I need to color that search keyword when found for each row. so i need assistance on expression code that mimics SQL syntax of LIKE in SSRS expression. I started to change the font color with =iif(Instr(Fields!ReportRecipients.Value)=Parameters!Keyword.Value,"Maroon","Black"), but it didnt work.
Please advise.
Sample
TOJo.eger#m.com; ruth.tuker#m.com;sandrae.espe#m.com; dan.gay#m.comIncludeReportTrueRenderFormatPDFSubjectDaily Report for IBC Medicare? was executed at #ExecutionTimeIncludeLinkFalsePriorityHIGH"
You can use some .net string functions directly in SSRS expressions. In your case you can use the Contains() function like this.
=IIF(
Fields!ReportRecipients.Value.Contains(Parameters!Keyword.Value),
"Maroon",
"Black"
)
If you are dealing with HTML and only want the search term to be highlighted then you can simply use this as the Value expression. You must leave the text box color properties as default.
=REPLACE(
Fields!ReportRecipients.Value,
Parameters!Keyword.Value,
"<span style=""color:red;"">" & Parameters!Keyword.Value & "</span>"
)
Finally, right-click the placeholder, choose properties and select Mark-up type as HTML
In this example, I used a country list and searched for the word "land", here's the results. The first column just uses the first method I described. The second column adds HTML tags.
I have the function:
wrap :: Text -> [Text] -> Text
wrap x = intercalate "" . map ((<> x) . (x <>))
The purpose of which is to wrap each element of a list with a given string and join them all together.
The brackets around the first argument to map annoy me, and so does the use of "". So I wonder is there a more elegant (or generic, I guess) way to express this function?
(Copied from my comment so the question can be marked as answered.)
You could use foldMap f instead of intercalate "" . map f. Note that intercalate "" is equivalent to Data.Text.concat.
Just to put my hat in the ring... Since the pattern is
xexxexxex
(where the es are placeholders for elements of the original list), another way you can build this output is by putting two xs between each element, and wrapping the bookends manually. So:
wrap x es = x <> intercalate (x <> x) es <> x
One small but nice feature of this rewrite is that for input lists of length n, this will incur only n+2 calls to (<>) rather than 3n-1 as in theindigamer's answer.
I need to create a form containing a select field where the options depend on the currently available mail accounts. I retrieve these mail accounts in a API request after the page has loaded.
The following function creates the form with the select element.
(defn create-options [mail-accounts]
(for [m mail-accounts]
[:option {:key (keyword (str (:id m)))
:value (:id m)}
(:name m)]))
(defn render-mail-account-select [mail-accounts]
(let [form-state (r/atom {})]
(fn [mail-accounts]
(let [form [:form.mailing-form.form-horizontal
(into [:select.form-control {:field :list :id :mail-account}]
(create-options mail-accounts))]]
(pprint form)
[bind-fields form form-state]))))
The pprint gives me the following output:
;; Before the mail-accounts are loaded
[:select.form-control {:field :list, :id :mail-account}]
;; After the state update containing the mail accounts
[:select.form-control
{:field :list, :id :mail-account}
[:option {:key :24, :value 24} "First mail account name"]
[:option {:key :25, :value 25} "Second mail account name"]]
My problem is that the select on my page stays empty as if the select does not get re-rendered.
Addendum
I think I forgot to add some code:
I am wrapping this form in a KIOO component where I dereference my state atom.
(defsnippet choose-account-panel "html/static-panel.html" [:div.panel]
[]
{[:h4.panel-title] (content "3. Mail Account wählen")
[:div.panel-body] (content [render-mail-account-select (:mail-accounts #state)])})
This component then calls my render-mail-account-select function and should re-render the form properly.
You need to dereference a Ratom for Reagent to know which functions need to be called again when that Ratom changes. That dereferencing needs to happen within the anonymous function inside render-mail-account-select, or one of the functions that it calls. I can’t see any dereferencing happening here?
See the docs here for more details on Reagent’s rendering.
As already pointed out, your render function must reference something in your state atom in order to know when it needs to be re-rendered. However, if you also want your displayed form to have a 'default' value selected, you also need to set your state atom.
The bind-fields call will associate your form with the state atom. If there is nothing in the state atom, the form will be 'blank' i.e. none of the elements selected. If this is what you want, then that should be fine. However, if you want a value selected, then you should put that value in the atom. For example, if you wanted the first item to be already selected, then put :24 into the state atom i.e.
(swap! form-state assoc :mail-account :24)
Note that I'm not sure your option definition is correct. The docs seem to indicate that you only need the :key attribute with the value (as a keyword) in that attribute. I've not looked at the source to confirm this, but none of the examples use a :value attribute as well.
If you do the swap at the beginning of your render function, then the state atom will have been referenced and your component should re-render each time it is called with new arguments. When I say 'render function', in this case, I mean the anonymous function, not the outer one which creates the state atom.
Afternoon all,
I have a simple bar graph in SSRS 2005. I wish to apply some conditional formatting to this bar graph but i am unable to get this working.
I believe that i should be able to add formmatting within the 'Chart Properties --> 'Data' tab --> 'Values' section? I have added the following code to the Expression editer but this doesnt work. when i preview the report it shows the bar graph colour as green as this is the default pallette?
=IIF(fields!Value.Value <=129, "blue", "yellow")
I have also tried to add this to the 'Format' property of the chart but i am still unable to see this formatting.
Am i missing something? Can anyone suggest a working solution or another method?
Regards
Betty
Should work OK? I replicated by setting an expression under Data Field -> Properties -> Appearance -> Series Style -> Fill -> Color.
=IIf(Fields!val.Value < 150, "Red", "Blue")
So something like:
Final result:
Only other consideration is that, depending on your underlying data, you might need an aggregate in the expression:
=IIf(Sum(Fields!val.Value) < 150, "Red", "Blue")
But you can see that it should be possible.
I have a problem with seesaw table. When I try to make up and show a simple table, it shows without column names.
What I did:
At first, I must say that I am using [seesaw "1.4.2"].
Then:
;; Clojure 1.4.0
(require '[seesaw.core :as ss])
(ss/native!)
(def main-window
(-> (ss/frame
:title "Main window")
ss/pack!
(ss/config! :minimum-size [320 :by 240])
ss/show!))
(def display
#(ss/config! main-window
:content %))
(display
(ss/table
:id :dumb-table
:model [:columns
[:one :another]
:rows
[["1" "2"]
["3" "4"]]]))
(source: leprosorium.com)
Table appears, but without column names, which, I guess, must be "one" and "another". What went wrong here?
It happens also if I use exactly the same code as in official wiki: https://github.com/daveray/seesaw/wiki/Tables
Update:
I forgot to mention, I'm using JDK 1.7u10, maybe it makes sense.
I dont know how to use seesaw table. but in general you need to add JTable to JScrollPane. This is because JScrollPane makes column header available at the top even when you scroll the data. if you dont want to use JScrollPane then u need to add the column header manually to the container so they stay at the top. So try adding JScrollPane.
Let me know if i went wrong...:)
Well, I think you missed some thing, ( see reference )
(display
(ss/table
:id :dumb-table
:model [:columns
[{:key :one, :text "One~1"}
{:key :one, :text "The Other~2"}]
:rows
[["1" "2"]
["3" "4"]]]))