I'm using Kendo UI numerictextbox. I need to change the width of a numerictextbox at runtime, according to external conditions. After invoking kendoNumericTextBox, for some events in the javascript I would like to change the width of the input part of k-numerictextbox. I'm not able to get it right.
As I understand Kendo uses two inputs: one for displaying the value (with readonly attribute) and the other for editing and the editable one is identified by the id I use.
I realized the hierarchy of classes created is:
class="k-widget k-numerictextbox"
class="k-numeric-wrap k-state-default k-expand-padding"
class="k-formatted-value k-numerictextbox k-input"
input = "myId" class="k-numerictextbox k-input"
So when I use $(#myid).width(newwidth); I am not changing the width of the field, worst I get an effect of enlarging (newwidth greater than oldwidth) at the level of the above k-numeric-wrap while the input part remains the same.
You don't have to change the width of the input but of the wrapper.
Do this:
$("#numeric").data("kendoNumericTextBox").wrapper.width("300px");
Where numeric is the id of the input corresponding to the Numeric Text Box.
Running example here : http://jsfiddle.net/OnaBai/7LBJG/
Related
I'm using Angular slickgrid and I want to change the cell color if the value is present in that cell.
Note: I want the color only for the cell not the whole row.
Is there any best way to iterate over all the cells and set the color or any equivalent solution?
I have a requirement to show the different cell colors depending on the data. Red color if the data is coming from the server and not changed (not dirty). If the data is edited or added new row (dirty), the cell color would be blue. I have updated the question.
function renderCellWithColor(cellNode, row, dataContext, colDef) {
if (dataContext[colDef.field] != ""){
$(cellNode).addClass("requiredClass"))
}
}
I'm using this function using enableAsyncPostRender. This does not work if I edit or add new row.
Use the option cssClass on the column definition or use a Custom Formatter returning an object following the FormatterResultObject, see Wikis Custom Formatter - FormatterResultObject - Wiki and sample - Wiki, the FormatterResultObject has the advantage of applying the CSS class to the cell container via the property addClasses and using the formatter object is the only way to get access to the cell container.
I've two fields on account form, one is two option(checkbox) and other is text box. As par my requirements, I've to not show the label of the checkbox but show them as simple fields without caption. I am done with it but stuck in a problem that it create a huge space between two fields, as shown in following screenshot. I would like to hear from your side to resolve this problem.
You could try this:
Set the tab to two columns, settings the first column around 5-10% (experiment with the value)
put the checkboxes in the first section, the other fields in the second one
set the first section to have 1 pixels for label width (instead of default 115)
I'm not sure how it would turn out, and would probably need some tweaking (to account for different form/window widths) but you might accomplish something close to what you need.
Another approach would be to build a custom HTML webresource, put it in an IFRAME as the only form element, and rebuild the form from scratch as you like... but it's probably best left as a last-est resort
You can convert the section from 2 columns to 4 columns, span the textbox field to 3 columns. This will reduce the checkbox field columns to 25% and textbox to 75%
This is the maximum we can do in supported way.
I use primefaces 5.2 and jsf 2.2.6 and I get a wrong width value in the columnResizeEvent when resizing the columns.
For the datatable I use the attribute resizeMode="expand", because I want to keep the size of the other columns the same when resizing a column.
But the problem is when I want the decrease the width of a column, I get a bigger value than the previous one, even though I decreased the width and even though in the user interface the column appears to have a smaller width as I want it to be.
When I don't use the attribute resizeMode on the datatable, the provided width from the ColumnResizeEvent is correct, but the size of the other columns are changed and I don't want that.
Is there a way to resize a column and keep the sizes of the others and at the same time to get a correct value of the column width?
So, it seemed that the problem was the widgetVar from the datatable, because I had several tables with the same value in the widgetVar for every single datatable and that's why it had the same clientId, because the same clientId was added to the DOM.
To find out more about the problem and solution, you can visit another post of mine, in which I want to use the same xhtml with a datatable for multiple tabs:
How to use the same datatable for all the tabs primefaces (resize not working in this case)
I am relatively new to .Net MVC 3 (using Razor syntax) and I am stuck with a small requirement.
I have a dropdpwn with two string values (Conservative, Moderate) in it. Each string value is associated with its corresponding 'Min', 'Max' and 'Avg' values coming from a Model. Now I have to show a horizontal bar graph with x values (Conservative, Moderate) and y values (0% to 100%). Now whenever I select a dropdown value, the graph should be updated in such a way that, it should color the area between 'Min' and 'Max' values on y-axis for Conservative, Moderate and also display the Min(Eg; 10%) and Max(Eg; 50%) values on the top of it for the selected dropdown value.
Also, the corresponding 'Average' value should be displayed as a pointer on the graph for the Conservative, Moderate (x values) when a checkbox (below the dropdown)is checked.
Thanks!!
You have several ways of doing this (even more than just this)
1. Do it the "MVC" way and use jQuery : ) Everyone is doing it : )
Use one of the jQuery graph plugins:
http://workshop.rs/jqbargraph/
make an ajax call an aspx page where you use a web forms chart control.
Use a partial view as your graph. Put that in an ajax.beginform. Selecting the dropdown values causes a postback to your controller method which packages your data - could be an inline image (you can fully encode the bytes to an image in html, thereby not requiring a separate call to load the image)
simply values that get turned into an html div that mimics a bar chart.
personally - I would choose #1
I need to resize the JQGrid column at runtime.
For eg: the column width for the column was 100px when it is loaded. I need to change it to 200 afterwards.
Please help.
Unfortunately there is no way to do this using the jqGrid API. From the documentation:
As mentioned above the options in colModel can be get or set using the methods getColProp and setColProp. Below are options which can not be changed dynamically when the grid is constructed (If changed they do not have effect or will cause the grid errors). For some of these options there are methods available to change the value:
name
width
resizable
label (method avail.)