New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TActivedropdownList will empty TActiveDataGrid #692
Comments
I'm not sure i understand the problem. The second and third images ("At editing" and "After selection change") are the same. Do you mean that even if you change the selection on the TActiveDropDownList it resets itself to the old value? One thing that i noticed: This should probably use a databind tag: |
Can i see the |
Here it is:
|
I see:
Try to remove it and add this instead: <prop:ItemTemplate>
<com:TLiteral Encode="true" Text="<%# $this->Parent->Data->Quelle %>"/>
<prop:ItemTemplate> |
place the ItemTemplate outside the TTemplateColumn definition: <com:TTemplateColumn ...>
<prop:ItemTemplate>
<!-- content -->
</prop:ItemTemplate>
<prop:EditItemTemplate>
<!-- content -->
</prop:EditItemTemplate>
</com:TTemplateColumn> |
This will work. :-) it seems for me, that the oncallback will do the same again. Thanks alot for your help!! |
OnSelectedIndexChanged is a generic method that works both for callbacks and postbacks, and exists both in TDropDownList and TActiveDropDownList. |
because it was wrong. |
Both the TDropDownlist and TActiveDropDownlist controls receive the OnSelectedIndexChanged event if their selection is changed, but in order to receive that event the page needs to be POSTed, either by a page load or by an ajax call. |
If in the same page load you change some innerHtml inside the datagrid and rebind the datagrid, it wll be updated twice:
That's why probably your changes are overwritten. |
Ok, thanks a lot for your help !!!! A+++ |
Sorry for this question, but I can't get to the fields of den EditItem (or the row/cells of the EditItemIndex) Thanks alot. |
Can you please elaborate a bit? |
No, I get the value of the changed Item in the dropdownlist. |
This is the object, I want to change:
|
I'm not sure i can understand and help you fixing the problem without debugging the app.
Sorry for the late answer. |
Ok, I will try this.
if the script fires the OnItemCreated="VersionCreated" event? |
You may want to use OnItemDataBound to set the values; it gets called after the item is created, when the data is databinded to the table: <com:TActiveDataGrid
...
OnItemDataBound="itemDataBound"
>
<com:TTemplateColumn ID="MyColumn" ...>
<prop:ItemTemplate>
...
</prop:ItemTemplate>
<prop:EditItemTemplate>
<com:TTextBox ID="MyTextBox" />
</prop:EditItemTemplate>
</com:TTemplateColumn>
</com:TActiveDataGrid> public function itemDataBound($sender, $param)
{
$item = $param->Item;
if ($item->ItemType === 'EditItem') {
// this is equivalent of using the databind tag <%# %> in the page template
$item->MyColumn->MyTextBox->Text = $item->Data->MyField;
}
} |
In order to retrieve the values after and edit, i see you are already using an |
Hmm, I've done this. With 3.3.2 it has worked fine. With 3.3.3 my results get overwritten. If I change something in this TActiveDropDownlist:
The OnSelectedIndexChanged event starts this php: protected function onSourceChanged($sender,$param){
$this->Session['sourcechanged'] = 1;
$sender->Parent->Quellehd->Value=$sender->Text;
... some other stuff ....
$this->Page->CallBackClient->callClientFunction ("updateEventFilter" , array ("onSourceChanged",$this->VersionGrid->EditItemIndex+2,"Info","$InfoEventFilter","$InfoEventFilterText"));
$this->Page->CallBackClient->callClientFunction ("updateEventFilter" , array ("onSourceChanged",$this->VersionGrid->EditItemIndex+2,"Info1","$Info1EventFilter","$Info1EventFilterText"));
$this->Page->CallBackClient->callClientFunction ("updateEventFilter" , array ("onSourceChanged",$this->VersionGrid->EditItemIndex+2,"Info2","$Info2EventFilter","$Info2EventFilterText"));
$this->Page->CallBackClient->callClientFunction ("updateEventFilter" , array ("onSourceChanged",$this->VersionGrid->EditItemIndex+2,"Warning","$WarningEventFilter","$WarningEventFilterText"));
$this->Page->CallBackClient->callClientFunction ("updateEventFilter" , array ("onSourceChanged",$this->VersionGrid->EditItemIndex+2,"RotEvent","$RotEventEventFilter","$RotEventEventFilterText"));
} And this is the javascript for the callback: function updateEventFilter(callerid,row_index,severity,eventfilter,eventfiltertext){
if (row_index && callerid == "onSourceChanged"){
if(eventfilter === ""){eventfilter = 1;}
var fieldhd = '<%=$this->VersionGrid->getClientID()%>'+'_ctl'+row_index+'_'+severity+'EventFiltertx';
var fieldbt = '<%=$this->VersionGrid->getClientID()%>'+'_ctl'+row_index+'_'+severity+'EventFilterbt';
document.getElementById(fieldhd).value = eventfilter;
document.getElementById(fieldbt).innerHTML = eventfiltertext;
}
}
--> but then the former values will be rewritten. Perhaps a databind with load-data will be performed. So I'll see the old, unchanged values again |
Comparing the changes between 3.3.2 and 3.3.3, i don't see anything that could be related to this: Just to understand if the problem is really the values being overwritten after you change them, does it works if you add a setTimeout around the javascript code that updates the innerHTML? |
Yes it works with a setTimeout. |
Closing. If you still need help, feel free to reopen, but it will be hard to fix the problem without a proper testcase in place. |
Hello,
if I use a TActiveDropdownList in the editmode of the TActiveDataGrid, the grid will be emptied after selection is changed in the dropdownlist:
Before:
At edititng:
After selection change:
And I'll see some uncaught exceptions:
I use version 3.3.3
The text was updated successfully, but these errors were encountered: