PDA

View Full Version : [CLOSED] what is the best way to update student‘s teacher?



tobros
Nov 06, 2013, 6:08 AM
when i show student's teacher in gridpanel , i use


<ext:ModelField Name="TeacherName" Type="Object" ServerMapping="Teacher.TeacherName"></ext:ModelField>

when i select the drop down list of teacher, i use a DropDownField as editor , so the value of teacher's column become the teacher's id , so i can change the student's teacher according teahcer's id from front .
but when do not change the drop down list of teacher, the value of teacher's column is teacher's name, so can not update student's other property such as student's name ,because update student need teahcer's id.
how to do?

another way , i do not use ServerMapping, but


<ext:ModelField Name="TeacherId" Type="int"></ext:ModelField>

I just get datas of student from db, but i must render Teahcer's id to teacher's name to show, it can update student because teacher's id is in modelfield.

but i think through ServerMapping, may be there is a easy way to do this which i do not know, is it? if no, ServerMapping is inconvenient for changing student's teacher.

Daniil
Nov 06, 2013, 7:32 AM
Hi @tobros,

Hard to suggest you something without playing with that scenario with a test case.

tobros
Nov 06, 2013, 9:26 AM
Hi @tobros,

Hard to suggest you something without playing with that scenario with a test case.

not a scenario but a discuss, the two way above all can be work, but which is better?

Daniil
Nov 06, 2013, 4:14 PM
Well, yes, I understand.

But you are also asking how to do something.


how to do?


The problem is the fact that I don't quite follow the scenario and cannot suggest anything concrete.

Baidaly
Nov 06, 2013, 4:33 PM
Hello tobros,

As I understand your requirements, I'd go with the first approach but add another field with Teacher's Id. So you always know your Id and can display Teacher's name.

Does it help?

ebeker
Nov 08, 2013, 4:16 AM
i have done project with ext.net and i had the same issue several time and i spent day to solve it but i was not lucky.
So i decided to create a method and solve my problem in 30 minutes that s basically does this

If SelectedItem.value is not integer

value= here i go pull up the Id from database with the value(string)

else
Everythng process normal

end if.

I am not saying this is the only way but this is a quick solution. I hope it helps someone else too.

Daniil
Nov 08, 2013, 4:45 AM
@ebeker, thank you for sharing that!