I read posts and seen examples but I am still strugling with setting up hierarchy grid with one popup editor form for both master/detail record(s).
I would like to setup a simple grid with html row detail
where grid data source is a nested json:
persons = [
{ name:"john", surname:"smith" },
{ name:"jane", surname:"doe",
contact: [
{ type:"email", value:"jane.doe#domain.com" },
{ type:"phone", value:"012345678" }
]
}
]
Top grid level displays name and surname where detail template shows
simple list of contacts (if any).
Grid needs to be editable through a popup editor where both data (master and detail) can be edited. Name and surname are binded to one form where contacts are displayed in a simple grid binded to a separate "contact" form located above it.
<form input fields for name and surname>
<form input fields for contacts, binded to a contacts table>
<contacts table>
<save><update><cancel>
Problems:
in detail row initialization I only get top level data (no contacts) so I am unable to render detail row with list of contacts
how to handle contacts part in popup editor? how to bind data?
Thank you for all your input, Peter
Found out that editing misbehaved due to missing "record id". Once I provided unique id I am getting expected results.
Duplicated question here.
Related
Im new to wix code. I created a simple database with a title field and some other fields as a test.
I created a text edit box so i can type in a search text, and a grid object so i can see the results.
I connect the grid to the data base and all the fields such as image, description etc.
Then i run the preview mode without typing anything, the grid shows all the table elements.
When i type into the search, even if i type something that is in the table, the grid is blank, seems the filter doesnt work??
Anybody knows why???
here is my code attached to the page
import wixData from "wix-data"
$w.onReady(function () {
});
export function iAddress_keyPress(event, $w) {
filter($w('#iAddress').value); // iAddress is the name of the input text box
}
function filter(title) {
$w('#dataset1').setFilter(wixData.filter().contains('Title',title));
}
Simple. This is problem:
contains('Title',title)
Title - it's "name" of the column. You should use "field name" from collection, it's displayed when you press "manage properties" on some column - it's actually id.
In your case, "title" is correct field name (as it's default)
Your example will work with this:
contains('title',title)
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) {...})
Due to performance reasons, I have a custom made table. The table consists of columns that are created as HTML DIVs, and the row is wrapped into an AbsolutePanel. The position of the column(s) and the row(s) is absolute and calculated on the render loop. The table is added into a ScrollPanel and only renders the visible portion of the rows, and adds rows when the user scrolls.
Customer requirement is to open a PopupPanel to show details about the row when the row is clicked. I've added a ClickHandler to the row panel by sinking the click event into it, which works fine.
The problem is, if I add e.g. a standard link or any clickable item into one of the cells in the table, clicking on the said item(s) results in also the row click handler firing, which I want to somehow prevent. The source of the event is the row Element, not the link/icon/whatever that was clicked.
Any help solving this (perhaps a completely different approach ?) is much appreciated.
I would use gwtquery because of its simplicity and performance.
I don't know the final dom renderized by your app, but if we suppose you have something like this:
<div id="column1">
<div id="row1_1" class="my_row" product_id="whatever"> content </div>
...
</div>
Your code could be something like this:
import static com.google.gwt.query.client.GQuery.*;
$(".my_row").click(new Function(){
public void f() {
// The gquery instance of the row clicked
GQuery thisRow = $(this);
// Use gquery methods to get some info of your row
String thisId = thisRow.id();
String productId = thisRow.attr("product_id");
Element thisElement = thisRow.get(0);
// do Something with your row
...
}
});
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>
I have setup a master/detail which shows the correct entries for each record.
However when a new record in the detail grid is created a field in the Add form of the detail grid should be filled out with a value from the master grid.
How can this be done?
You should add code like this:
onclickSubmit: function(re, data){
var master_id = mastertGrid.getGridParam('selrow');
return {'master_id' : master_id };
}
in the "add options" of the slave grid.
Have a look at this post.