I added list column as below using pnp js and api call is working without issue. but Column is hidden even it is created.
is there any reason for that ?
var fieldXML = "<Field Hidden='FALSE' DisplayName='455' Format='Dropdown' IsModern='TRUE' MaxLength='255' Name='455' Title='455' Type='Text'><Default>11</Default></Field>";
sp.web.lists.getByTitle("listTitle").fields.createFieldAsXml(fieldXML).then(function (result) {
//success
});
Have you checked if list has custom default view on? When you add a column to a list it should be visible in "all items" view but not in custom views unless added.
Related
I'm adding a new fields to my views through my custom module.
When I open up the views page UI, the field is not show up. However, If I edit the view on UI and click add field, I can see my custom field is available to add.
My question, how can I add automatically that field to the list of fields to display on the views?
function mymodule_views_default_views() {
...
$handler->display->display_options['fields']['myfield']['id'] = 'fieldname';
$handler->display->display_options['fields']['myfield']['table'] = 'databaseTableName';
$handler->display->display_options['fields']['myfield']['field'] = 'fieldname';
...
}
Could you give some simple example of how to create form that consists of only dropdownlist?
I want to use it to create admin-side user management to assign users to one role, with aspnet mvc simplemembership. I mean step by step:
- list all registered users (DONE)
- next to their nicks show dropdown list; selected value is user's current role using
Roles.AddUserToRole(item.UserName, "RoleName");
by changing dropdown value assign user to new role (overwrite old one) with ajax (don't reload page, just show for few seconds success/error status)
Anyway, I'd like similar example how to do it, it doesn't have to be code I exactly need to produce.
Many thanks in advance.
$("#dropdown").on("change keyup", function() {
var selected = $(this).val();
$.post("/Controller/AssignRole", {selectedRole: selected}, function(data) {
//data is the value returned by your action method.
//example: partial view, or status message
$("#status").html(data); //success message
});
});
I have a Kendo UI grid which uses a dropdown as the editor for a field. I'm having problems getting the dropdown to properly bind to the viewModel (at least I think that is the issue). If I make a selection from the dropdown then add a new row or navigate from the row I am on, the field shows [object Object]. Now if I go back to the row and make a different selection and navigate to a different row, it behaves like it should, showing the selection I made. Here is a js bin showing the behavior.
The problem is SuggestedVendor type is string but when you click Add New Line Item link to add new item you set some default value Id: 1, Position: 1 and SuggestedVendor : null but it should empty string like SuggestedVendor : ''
dataSource.add({ Id: 1, SuggestedVendor: (viewModel.suggestedVendor === null) ? '' /* instead of null*/ : viewModel.suggestedVendor.SuggestedVendor, Position:1 });
Working demo
Note:
You can set your default value during datasource field declaration, for more details demo for custom editing. In this way you don't need manually handle $(".k-grid-custom-create").on("click", function (e) {...})
I'm using a Kendo DropDownListFor which populates from a DB table. I want to add an option at the end that says "Add New..." which takes the user to a Create view for that DB table. Is there a way to do this (preferably in the MVC Helper, not in javascript).
Not possible without JavaScript. If using JavaScript you need to use the change event and see if the value is equal to that last item in the list then navigate the page. Something like this:
function onChangeOfDDl(e){
if(...) { //you condition
window.location.href = "/editRecord/" + this.value()
// this.value() will give you the value for the selected item or the text if no underlying value exists
}
}
I am planning of using a cascading kendo drop down.
Drop down 1 - Countries - it will list down all the countries.
Drop down 2 - States - Based on the selection of the country I have to show the states here.
The data for both are loaded from my api controllers. I referred to this link
http://demos.kendoui.com/web/dropdownlist/cascadingdropdownlist.html
But, I need to pass the first selected value to the second drop down.
PLease suggest the best way to do it. Examples would be really helpful.
Thanks.
you have to use events for that
http://demos.kendoui.com/web/dropdownlist/events.html
.Events(e =>
{
e.Change("change").Select("select").Open("open").Close("close").DataBound("dataBound");
})
<script>
function change() {
// get a reference to the dropdown list
var dropdownlist = $("#dropdownlistTwoForStates").data("kendoDropDownList");
//Write your logic here to bind data for thie dropdown
// disable the dropdown list
dropdownlist.enable(true);
};
</script>