A place for users and developers of the Xataface to discuss and receive support.
by andperry » Thu Dec 10, 2009 1:44 am
I notice that the title drop-down list on the edit screen for a record always shows the first record in the table. This raises the following two issues:-
1. It is not possible to use this list to actually go to the first record in the table.
2. The back and forward arrows either side of the list are confusing because they operate in relation to the current record which is not necessarily what is displayed in the list.
Is there any way that the list can be made to display the current record rather than the first record? If this is not practically possible, then would it be possible to place a dummy entry at the start of the list with words such as "Please select record . . ."?
Regards,
Andrew.
-
andperry
-
- Posts: 57
- Joined: Wed Feb 18, 2009 9:20 am
- Location: Wirral, UK
by shannah » Fri Dec 11, 2009 10:04 am
This is a bug that has been with Xataface for a while. The title menu is generated by the jumpMenu() method in the ResultController.php class. You can try poking around in there if you want to try to fix it.
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by kevinwen » Wed Jan 13, 2010 7:11 pm
Hi, Steve I fixed this bug already. Please take a look at 2 functions modified in ResultController: - Code: Select all
function getContentsList(){ $selected_url = ''; if (! isset( $this->_contentsList) ){ $this->_contentsList = array(); if ( $this->getTotalRecords() > 100 ){ // there are over 100 records in this found set. It is unfeasible // to list them all in the jump menu, so instead we will list ranges // of records //$totalRecords = $this->getTotalRecords(); //for ( $i=0; $i<$totalRecords; $i+=$this->_query['-limit']){ // $query = array_merge($this->_query, array("-skip"=>$i, "-action"=>"list")); // $link = $this->_buildLink($query); // $this->_contentsList[$link] = ($i+1)." to ".($i+$this->_query['-limit']); // // if ( $this->_resultSet->start() >= $i and $this->_resultSet->start() < ($i+$this->_query['-limit'])){ // $selected_url = $link; // } //} } else { // There are less than 100 records.. Just list them individually //$sql = $this->_queryBuilder->select( // array($this->_titleColumn), // array('-skip'=>null, '-limit'=>null) // ); //$res = mysql_query( // $sql, // $this->_db //); $selected_url = ''; $titles =& $this->_resultSet->getTitles(false, true,true); $index = 0; //while ( $row = mysql_fetch_array($res) ){ $len = count($titles); for ($index =0 ; $index < $len; $index++){ //$query = array( "-cursor"=>$index++, "-action"=>'browse'); $query = array( "-cursor"=>$index, "-action"=>'browse'); $query = array_merge( $this->_query, $query); foreach ($query as $key=>$value) { if ( $value === null ){ unset($query[$key]); } } $link = $this->_buildSetLink($query) ; //$this->_contentsList[ $link ] = $row[0]; $this->_contentsList[ $link ] = $titles[$index]; //if ( $index-1 == $this->_query['-cursor'] ){ if ( $index == $this->_query['-cursor'] ){ $selected_url = $link; } } } } return array($this->_contentsList, $selected_url); } function jumpMenu(){ list($contents, $selected_url) = $this->getContentsList(); if ( $contents ){ $html = '<select name="controller" class="jumpMenu" onchange="javascript:window.location=this.options[this.selectedIndex].value;"> '; $currentLink = Dataface_LinkTool::buildLink(array()); $currentLink = preg_replace('/&?-limit=\d+/', '', $currentLink); // link sans limit for use in field to specify number of records to be displayed per page foreach ($contents as $key=>$value){ $selected = $key==$selected_url ? "selected" : ''; $html .= ' <option value="'.$key.'" '.$selected.'>'.$value.'</option>'; } $html .= '</select>'; } else { $html = ''; } return $html; }
Let me know your thought.
-
kevinwen
-
- Posts: 109
- Joined: Mon Dec 28, 2009 3:44 pm
by thesnowsnake » Wed Aug 24, 2011 4:01 pm
Wow that looks really impressive and is well documented..
Thanks for the effort
-
thesnowsnake
-
- Posts: 23
- Joined: Thu Jul 28, 2011 9:02 am
by fantomasdm » Thu Aug 25, 2011 12:04 am
Very Very good!!
-
fantomasdm
-
- Posts: 114
- Joined: Thu Mar 13, 2008 2:35 pm
by andperry » Wed Aug 31, 2011 9:24 am
Many thanks for the solution. I've given it a quick try and it seems to work OK.
When might it be incorporated into a release of Xataface?
Thanks,
Andrew Perry.
-
andperry
-
- Posts: 57
- Joined: Wed Feb 18, 2009 9:20 am
- Location: Wirral, UK
Return to Xataface Users
Who is online
Users browsing this forum: No registered users and 17 guests
|