Closed Methraen closed 4 years ago
@Methraen
Current value for you is test
parametr of your lamba. You have whole row object in this value and you can use it
@Mewriick I dont know how i didnt saw this, i think my brain overheated, thank you.
@Mewriick
I changed (enumStringValue == actualStringValue)
to (enumStringValue == test.Sexe)
but then, when i click on the edit row button the site freeze and dont respond anymore.. Any idea ?
@Methraen
It could be badly builded renderer tree. Some closing tag can be missed or maybe much more closing tags than opening
@Mewriick I did not find missed closing tag or too much opening tag.. the problem is maybe in the loop...
Func<EditColumnContext, RenderFragment<TestDto>> editRenderAge =
context =>
{
RenderFragment<TestDto> ageEdit = (TestDto test) => delegate (RenderTreeBuilder rendererTreeBuilder)
{
var internalBuilder = new BlazorRendererTreeBuilder(rendererTreeBuilder);
internalBuilder
.OpenElement(HtmlTagNames.Div, "edit-field-wrapper")//Open 1
.OpenElement(HtmlTagNames.Select, "edit-text-field")//Open 2
.AddAttribute(HtmlJSEvents.OnChange, EventCallback.Factory.Create(this,
(ChangeEventArgs e) =>
{
context.NotifyValueHasChanged($"{BindConverterExtensions.ConvertTo(e.Value, String.Empty)}_CustomEdit");
})
);
List<String> enumTypeValue = new List<string>() { "18-35", "35-50", "50+" };
foreach (var enumValue in Enum.GetValues(enumTypeValue.GetType()))
{
var enumStringValue = enumValue.ToString();
internalBuilder.OpenElement(HtmlTagNames.Option);//Open 3
if (enumStringValue == test.TrancheAge)
{
internalBuilder.AddAttribute(HtmlAttributes.Selected, true);
}
internalBuilder
.AddAttribute(HtmlAttributes.Value, enumStringValue)
.AddContent(enumStringValue)
.CloseElement();//Close 3
}
internalBuilder
.CloseElement()//Close 2
.CloseElement();//Close 1
};
return ageEdit;
};
It worked without changing anything in particular... ty anyway.
@Mewriick Hello again, it's been a while! Im currently trying to make an select input based on what you told me, and im having a little issue \: (I followed the example you made here \: Blazor.FlexGrid/src/Blazor.FlexGrid/Components/Renderers/EditInputs/SelectInputRenderer.cs) i know i need
IActualItemContext<object>
to get the current value but RenderFragment cant get a second parameter so how do i get it ?