- Code: Select all
function initiateEditor()
{
$tableColumns['ProvinceID']= array('display_text' => 'Province', 'perms' => 'EVCTAXQS', 'join' => array('table' => 'lutprovince', 'column' => 'ProvinceID', 'display_mask' => "ProvinceName", 'type' => 'left'),'req' => true, 'input_info' => 'onchange="toAjaxTableEditor(\'update_district\',this.value);"');
$tableColumns['DistrictID']= array('display_text' => 'District', 'perms' => 'EVCTAXQS', 'join' => array('table' => 'lutdistrict', 'column' => 'DistrictID', 'display_mask' => "DistrictName", 'type' => 'left'),'req' => true, 'input_info' => 'onchange="toAjaxTableEditor(\'update_commune\',this.value);"');
$tableColumns['CommuneID']= array('display_text' => 'Commune', 'perms' => 'EVCTAXQS', 'join'=>array('table' => 'lutcommune', 'column' => 'CommuneID', 'display_mask' => 'CommuneName', 'type' => 'left'), 'input_info' => 'onchange="toAjaxTableEditor(\'update_village\',this.value);"');
$tableColumns['VillageID']= array('display_text' => 'Village', 'perms' => 'EVCTAXQS', 'join'=>array('table'=>'lutvillage', 'column'=>'VillageID', 'display_mask'=>'VillageName', 'type'=>'left'));
$userActions = array('update_district' => array(&$this,'updateDistrict'),
'update_commune' => array(&$this,'updateCommune'),
'update_village' => array(&$this,'updateVillage'));
$this->Editor->setConfig('userActions',$userActions);
}
function updateDistrict($proId)
{
if(!empty($proId)){
$query = "select DistrictID,DistrictName from lutdistrict where ProvinceID = $proId";
$result = $this->retrieve_data( $query , $mode = 'mysql_fetch_assoc' );
$istr = "\'update_commune\'" ;
$str = '<select id="DistrictID" onchange="toAjaxTableEditor('.istr.',this.value);" name="DistrictID"><option value="">Select One</option>';
foreach( $result as $results )
{
$str.='<option value="'.$results['DistrictID'].'">'.$results['DistrictName'].'</option>';
}
$str.='</select>';
$javascript = '$(\'DistrictID\').replace(\''.$str.'\');';
$this->Editor->retArr[] = array('where' => 'javascript', 'value' => $javascript);
}
}
function updateCommune($disId)
{
if(!empty($disId)){
$query = "select CommuneID,CommuneName from lutcommune where DistrictID = $disId";
$result = $this->retrieve_data( $query , $mode = 'mysql_fetch_assoc' );
$istr = "\'update_village\'" ;
$str = '<select id="CommuneID" name="CommuneID" onchange="toAjaxTableEditor('.$istr.',this.value);"><option value="">Select One</option>';
foreach( $result as $results )
{
$str.='<option value="'.$results['CommuneID'].'">'.$results['CommuneName'].'</option>';
}
$str.='</select>';
$javascript = '$(\'CommuneID\').replace(\''.$str.'\');';
$this->Editor->retArr[] = array('where' => 'javascript', 'value' => $javascript);
}
}
function updateVillage($comId)
{
if(!empty($comId)){
$query = "select VillageID,VillageName from lutvillage where CommuneID = $comId";
$result = $this->retrieve_data( $query , $mode = 'mysql_fetch_assoc' );
$str = '<select id="VillageID" name="VillageID"><option value="" >Select One</option>';
foreach( $result as $results )
{
$str.='<option value="'.$results['VillageID'].'">'.$results['VillageName'].'</option>';
}
$str.='</select>';
$javascript = '$(\'VillageID\').replace(\''.$str.'\');';
$this->Editor->retArr[] = array('where' => 'javascript', 'value' => $javascript);
}
}
I just added:
$istr = "\'update_commune\'" ;
$str = '<select id="DistrictID" onchange="toAjaxTableEditor('.istr.',this.value);" name="DistrictID"><option value="">Select One</option>';
One more thing, How could I set the width of table screen in Edit or View mode?