Hello,
I have multidimentional array.
like:
$skill_array={
Database,test db skill 2,0,1,2014-Mar,ZCZC,1
Framwork,test fm skill,0,1,2014-Mar,axaxax,0
Networking,test db skill 2,0,1,2014-Mar,yt89887i,1
Database,test db skill 2,0,1,2014-Mar,hkjk,0
}
while showing this table in UI in javascript,
I want to show table in sorted format of 0th index.
i.e in above example,
it should come as
`
$skill_array={
Database,test db skill 2,0,1,2014-Mar,ZCZC,1
Database,test db skill 2,0,1,2014-Mar,hkjk,0
Framwork,test fm skill,0,1,2014-Mar,axaxax,0
Networking,test db skill 2,0,1,2014-Mar,yt89887i,1
}`
could you help me please.
Case is,
I have declared one table inside onw div in my php code.
and I am inserting my tr and td values to that table in javascript (wher i get the final array)
I have used below code for it.
skill_array // HERE I GET THE SKILL ARRAY VALUES AS THEY ARE APPENDED IN ARRAY i.e. UNSORTED
var last_tr_id = $('div#information-table tr:last').attr('id');
var tr_id=++last_tr_id;
var global_arrayLength = skill_array.length;
var html="";
var html_1="";
$('table#myTable tr').not(':first').remove(); // this function removes the already appended values to myTable
// define tr id for table which is to be append to myTable
var tr_tmp_value=1;
var other_skill_tr_value=1;
global_other_skill_arrayLength=other_skill_array.length;
for(var index=0;index < global_arrayLength;index++)
{
html+='<tr id='+(tr_tmp_value++)+' >';
for(inner_index=0;inner_index <= 5;inner_index++)
{
if(inner_index==2)
{
html+='<td>'+skill_array[index][inner_index]+' Years and '+skill_array[index][inner_index+1]+' months</td>';
inner_index++;
}
else
html+='<td>'+skill_array[index][inner_index]+'</td>';
}
// is_other_skill
html+='<td><a onClick=edit_skill('+(tr_tmp_value-1)+','+0+');>'+EDIT+'</td>';
html+="</tr>";
The issue i am facing in sorting is ,
In above code I have given ID tr to edit_skill() function so that on clicking on it, it allows me to edit its values and update array.
html+='<td><a onClick=edit_skill('+(tr_tmp_value-1)+','+0+');>'+EDIT+'</td>';
when I show sorted array,
then I should not loose/change my this parameter for edit_skill().
Hope I am able to put down my doubt clearly.