I use grapejs, and I need to change the text language. There is 'i81n' for labels, but I couldn't find anything for inputs like this as you can see i change the label language with i18n but selectbox's options are still english Also if it's possible, As you can see in the pic I need to change the placeholder for text input and the title 'text' above it
I Found how to change inputs. You have to change your props one by one. You can find the details in
https://github.com/artf/grapesjs/issues/2712#issuecomment-615763048
And for the second issue you have to add your i18n file domComponents. in my scenario it's like this
var _default = {domComponents: {
names: {
'': 'Kutu',
wrapper: 'Gövde',
text: 'Metin',
comment: 'Yorum',
image: 'Görsel',
video: 'Video',
label: 'Etiket',
link: 'Link',
map: 'Harita',
tfoot: 'Tablo alt',
tbody: 'Tablo gövde',
thead: 'Tablo başlık',
table: 'Tablo',
row: 'Satır',
cell: 'Hücre'
}...}..}
Document for this is here : https://grapesjs.com/docs/modules/I18n.html#plugin-development
Related
I am using the shinyJS package as well as shiny tags and traditional HTML to add the attribute 'title' to existing elements. I am able to do this without issue within the console (inspector [Google CHROME]) but when attempting to apply the same inputs via either ui.R or server.R, either nothing changes or the actual text value changes vice adding title (tooltip).
As mentioned above, I have tried the following:
shinyJS: html()
shiny: tags$HTML; tags$body(tags$script())
HTML: Adding the change in HTML file (mychange.html) and sourcing from www
The input to modify (add tooltip)
pickerInput(
inputid = "ReqTabSel6",
label = '',
choices = c('Choice 1', 'Choice 2', 'Choice 3'),
mulitple = F,
options = list(
style = "btn-info"))
Here is the correct function (as it updates when running in console under web inspector):
var addToolTip1 = document.querySelector('#form>div:nth-child(10)>div>div>div>ul>li.selected>a')
var att = document.createAttribute("title");
att.value = "I am a tooltip title";
addToolTip1 .setAttributeNode(att);
However, in R...
shinyJS
server.R
...
observeEvent(input$ReqTabSel6, {
shinyJS::html(id = NULL,
html = "var addToolTip1 = document.querySelector('#form>div:nth-child(10)>div>div>div>ul>li.selected>a')
var att = document.createAttribute("title");
att.value = "I am a tooltip title";
addToolTip1 .setAttributeNode(att);",
selector = '#form>div:nth-child(10)>div>div>div>ul>li.selected>a')
})
##This updates the actual 'choice' value from 'Choice 1' to 'Choice1I am a tooltip title')
#Changing html to read:
html = 'title = "I am a tooltip title"',
#This replaces the choice (e.g. Choice 1) value so the drop down now has:
I am a tooltip title
Choice 2
Choice 3
Would like to create the tooltip for each child (tab index) of the pickerInput choices. Should just add 'title' attribute to other attributes within the designated node.
Got it! Answering it myself in case another user runs in to this.
#server.R
observeEvent(input$actionbutton1,{
shinyjs::html(
html='<a tabindex="0" class=""...title="Your tooltip here"...></a>',
add=FALSE,
selector = '#form>div>form>div>div:nth-child(5)>div>div>div>ul>li:nth-child(4)' #This is the jquerySelector. Note that it will be different for each unique application. You will need to change the 'nth-child(#)' to the specific choice within 'SelectInput' to get a tooltip specific to that choice.)
})
For my project I want different pop-ups for different useage. So I created a new css class. Now I want to change the style of the title component (as shown below) on the same way as I changed the buttons.
So my question is: can I change the css of the title the same way as I change the css of the buttons? With the className property. Also, how should I do that?
bootbox.dialog({
message: "<h4>" + errorMessage + "<h4>",
title: $filter("translate")("Warning"),
buttons: {
no: {
label: $filter("translate")("Cancel"),
className: "c-btn-declined-selection c-btn-global-warning",
callback: noCallback
},
yes: {
label: $filter("translate")("Confirm"),
className: "c-btn-confirm-selection c-btn-global-warning",
callback: yesCallback
}
}
From reading the Bootbox.js documentation, it seems that an inherent title-styling method doesn't exist. This leaves you with two options...
1. Add the style/class in-line:
bootbox.dialog({
//...
title: "<span style='color: red;'>This title is red</span>",
//...
})
bootbox.dialog({
//...
title: "<span class="redText">This title is red</span>",
//...
})
2. Manipulate the generated elements manually
Right click your Bootbox dialog on the page and go to Inspect Element. From here you'll see the generated content, including classes and elements, from which you can just use some basic CSS rules to style them.
For example, if the pop-up HTML looked like this...
<div class='bootbox-popup'>
<h4 class='popup-title'></h4>
<div class='popup-body'> ... </div>
</div>
You could style it using something like:
h4.popup-title {
color: red;
}
Hi i have to create an Checkbox which is set up in JavaScript Code. For that we are using DOJO in our project. This Checkbox should just be visible for one project so i can't insert on html side. To realise the Checkbox wasn't a problem and also the visability. But i can't set a label which should be next to the Checkbox.
HTML Code:
JavaScript Code:
if (this.createCheckInput)
{
this.checkInput = new CheckBox({
name: "checkBox",
id: "checkId",
value: "agreed",
innerHTML: "Publish", //Label i wan't to create
onChange: lang.hitch(this, function (p)
{
if (p == true) {
this.checkboxChecked = p;
}
})
}, this.publishCheckbox);
}
I Also tried it with another JavaScript Element but there is no DOJO Library I can use i just find the Textarea but the user should not be able to change the text.
JavaScript Code 2:
//create title for checkbox
if (this.createInputLabel)
{
this.showInputLabel = new Textarea ({
value : 'Publish after upload'
},this.publishCheckboxLabel);
}
Thanks for helping :)
Why not simply creating a label element ? why going so complex ?
Using dojo/dom-construct:
domConstruct('label', {innerHTML: 'Publish after upload'}, this.publishCheckboxLabel);
At first I want to say that I'm beginner in Javascript, so I can't edit my function correctly.
For now I have clickable text to remove row, but I want to use image instead of text.
This is part of function:
...
var removeRow = $.fn.optionTest.createColumn($("<a>", options.removeLinkOptions).text('Remove Row'));
row.append(id).append(label).append(from).append(to).append(removeRow);
I can't achieve correct syntax, I've tried something like, but unsuccessfully...
var removeRow = $.fn.optionTest.createColumn($("<a>", options.removeLinkOptions).src("http://linktoimage.com/img.jpg"));
Thank you for understanding and trying to help!
UPDATE
Later I'm using removeRow in following, It have href: 'javascript:;', maybe that's why not working?
$.fn.optionTest.defaults = {
clearOnChange: false,
actionId: '#action',
indexOptions: {
class: 'div-format-test'
},
rowOptions: {
id: 'option',
class: 'div-format',
tag: 'tr'
},
fromOptions: {
name: 'from',
type: 'text',
value: 'from',
size: 20
},
toOptions: {
name: 'to',
type: 'text',
value: 'to',
size: 20
},
removeLinkOptions: {
class: 'removeRow',
href: 'javascript:;'
}
};
For now I've change code like:
var removeRow = $.fn.optionTest.createColumn($("<img>", options.removeLinkOptions).src("http://www.somelink.com/image.png"));
But seems like there is wrong syntax rows not appear at all now...
use an <img> instead of <a> for an image. <a> is used for a link.
Thanks
In addition to the already mentioned changing <a> to <img>, you also need to set the attribute in order to change the image source. Using .attr('src','...') instead of .src('...') should fix it.
Changing this:
var removeRow = $.fn.optionTest.createColumn($("<img>", options.removeLinkOptions).src("http://www.somelink.com/image.png"));
To this:
var removeRow = $.fn.optionTest.createColumn($("<img>", options.removeLinkOptions).attr("src","http://www.somelink.com/image.png"));
That should fix your issue. Hope that helps!
I am using ng-grid , i have implemented search functionality on it but i want to change orderby option by changing drop down value.
I wish to provide drop down on change of its value data soting should happen.
by default Sort-functionality is there which works on click of table heading but i need to change sorting order on change of dropdown.
This code i got from somewhere but i dont know how to use it ?
$scope.gridOptions = {
data: 'gridData',
columnDefs: [
{field: 'name', displayName: 'Name'},
{field:'ageWord', displayName: 'Age'}
],
sortInfo: {
fields: ['age'],
directions: ['asc']
}
};
You need to define values for the sortInfo and useExternalSorting of your grid options, like this:
$scope.gridOptions.useExternalSorting = true;
$scope.gridOptions.sortInfo = {
fields: [$scope.selectedDropDownOption], // <-- or whatever variable used to store selected option from dropdown
directions: ['asc']
};
e.g.: if you want to sort by name, you could set
sortInfo: { fields: ['name'], directions: ['asc']}
this would order your grid by name and ascending
you also want to set useExternalSorting = true in your gridOptions.
i suggest you have a look at the docu and examples pages
I used following code ,,,
HTML :
<input type="text" ng-model="sortColumn"></input>
<button type="button" class="btn" ng-click="updateSortInfo()">Sort</button>
aap.js ::
$scope.updateSortInfo = function() {
$scope.gridOptions.sortBy($scope.sortColumn);
}
Reached here while searching for solution of similar thing. After trying all options I have applied this.
//Disable Grid Ui Sorting through header
$scope.gridOptions.enableSorting = false;
//Apply angular 'orderBy' filter to data for grid ui
$scope.resultSetTable = $filter('orderBy')($scope.gridData, 'YOUR_SORT_COLUMN');
// Apply data to grid ui
$scope.gridOptions.data = $scope.resultSetTable;